handle error when during initialization of vips

This commit is contained in:
JovannMC 2025-01-12 21:24:07 +03:00
parent 57976e7879
commit 40e99e0a20
No known key found for this signature in database
1 changed files with 8 additions and 1 deletions

View File

@ -43,7 +43,14 @@ export class VipsConverter extends Converter {
this.worker.onmessage = (e) => {
const message: WorkerMessage = e.data;
log(["converters", this.name], `received message ${message.type}`);
if (message.type === "loaded") this.ready = true;
if (message.type === "loaded") {
this.ready = true;
} else if (message.type === "error") {
error(["converters", this.name], `error in worker: ${message.error}`);
throw new Error(message.error);
} else {
error(["converters", this.name], `unknown message type ${message.type}`);
}
};
}