mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-28 20:40:12 +02:00
web/queue: move error() out of createSavePipeline closure
This commit is contained in:
parent
3d92a85ba2
commit
426c073d5f
@ -109,11 +109,7 @@ const makeGifArgs = () => {
|
||||
];
|
||||
}
|
||||
|
||||
export const createSavePipeline = (info: CobaltLocalProcessingResponse, request: CobaltSaveRequestBody) => {
|
||||
// this is a pre-queue part of processing,
|
||||
// so errors have to be returned via a regular dialog
|
||||
|
||||
const error = (errorCode: string) => {
|
||||
const showError = (errorCode: string) => {
|
||||
return createDialog({
|
||||
id: "pipeline-error",
|
||||
type: "small",
|
||||
@ -129,8 +125,12 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
||||
});
|
||||
}
|
||||
|
||||
export const createSavePipeline = (info: CobaltLocalProcessingResponse, request: CobaltSaveRequestBody) => {
|
||||
// this is a pre-queue part of processing,
|
||||
// so errors have to be returned via a regular dialog
|
||||
|
||||
if (!info.output?.filename || !info.output?.type) {
|
||||
return error("pipeline.missing_response_data");
|
||||
return showError("pipeline.missing_response_data");
|
||||
}
|
||||
|
||||
const parentId = crypto.randomUUID();
|
||||
@ -160,7 +160,7 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
||||
const args = makeAudioArgs(info);
|
||||
|
||||
if (!args) {
|
||||
return error("pipeline.missing_response_data");
|
||||
return showError("pipeline.missing_response_data");
|
||||
}
|
||||
|
||||
workerType = "encode";
|
||||
@ -169,7 +169,8 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
||||
workerType = "encode";
|
||||
ffargs = makeGifArgs();
|
||||
} else {
|
||||
throw new Error("unknown work type: " + info.type);
|
||||
console.error("unknown work type: " + info.type);
|
||||
return showError("pipeline.missing_response_data");
|
||||
}
|
||||
|
||||
pipeline.push({
|
||||
|
Loading…
x
Reference in New Issue
Block a user