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,28 +109,28 @@ const makeGifArgs = () => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showError = (errorCode: string) => {
|
||||||
|
return createDialog({
|
||||||
|
id: "pipeline-error",
|
||||||
|
type: "small",
|
||||||
|
meowbalt: "error",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: get(t)("button.gotit"),
|
||||||
|
main: true,
|
||||||
|
action: () => {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
bodyText: get(t)(`error.${errorCode}`),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const createSavePipeline = (info: CobaltLocalProcessingResponse, request: CobaltSaveRequestBody) => {
|
export const createSavePipeline = (info: CobaltLocalProcessingResponse, request: CobaltSaveRequestBody) => {
|
||||||
// this is a pre-queue part of processing,
|
// this is a pre-queue part of processing,
|
||||||
// so errors have to be returned via a regular dialog
|
// so errors have to be returned via a regular dialog
|
||||||
|
|
||||||
const error = (errorCode: string) => {
|
|
||||||
return createDialog({
|
|
||||||
id: "pipeline-error",
|
|
||||||
type: "small",
|
|
||||||
meowbalt: "error",
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: get(t)("button.gotit"),
|
|
||||||
main: true,
|
|
||||||
action: () => {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bodyText: get(t)(`error.${errorCode}`),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!info.output?.filename || !info.output?.type) {
|
if (!info.output?.filename || !info.output?.type) {
|
||||||
return error("pipeline.missing_response_data");
|
return showError("pipeline.missing_response_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentId = crypto.randomUUID();
|
const parentId = crypto.randomUUID();
|
||||||
@ -160,7 +160,7 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
|||||||
const args = makeAudioArgs(info);
|
const args = makeAudioArgs(info);
|
||||||
|
|
||||||
if (!args) {
|
if (!args) {
|
||||||
return error("pipeline.missing_response_data");
|
return showError("pipeline.missing_response_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
workerType = "encode";
|
workerType = "encode";
|
||||||
@ -169,7 +169,8 @@ export const createSavePipeline = (info: CobaltLocalProcessingResponse, request:
|
|||||||
workerType = "encode";
|
workerType = "encode";
|
||||||
ffargs = makeGifArgs();
|
ffargs = makeGifArgs();
|
||||||
} else {
|
} else {
|
||||||
throw new Error("unknown work type: " + info.type);
|
console.error("unknown work type: " + info.type);
|
||||||
|
return showError("pipeline.missing_response_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.push({
|
pipeline.push({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user