Skip to content

Commit

Permalink
added file parameter when file not found message sent to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Sep 9, 2024
1 parent 6cdaff9 commit 244091b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ const getWavePredictBuffers = async ({
predictionsRequested[file] = 0;
let readStream;
if (! fs.existsSync(file)) {
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`})
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file})
return new Error('getWavePredictBuffers: Error extracting audio segment: File not found.');
}
// extract the header. With bext and iXML metadata, this can be up to 128k, hence 131072
Expand Down Expand Up @@ -1341,7 +1341,7 @@ const getPredictBuffers = async ({
let chunkStart = start * sampleRate;
return new Promise((resolve, reject) => {
if (! fs.existsSync(file)) {
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`})
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file})
return reject(new Error('getPredictBuffers: Error extracting audio segment: File not found.'));
}
let concatenatedBuffer = Buffer.alloc(0);
Expand Down Expand Up @@ -1804,7 +1804,7 @@ const bufferToAudio = async ({
return new Promise(function (resolve, reject) {
const bufferStream = new PassThrough();
if (! fs.existsSync(file)) {
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`})
UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file})
return reject(new Error('bufferToAudio: Error extracting audio segment: File not found.'));
}
let ffmpgCommand = ffmpeg(file)
Expand Down

0 comments on commit 244091b

Please sign in to comment.