Appearance
Error handling made easy
Errors from Exec's are thrown and propagated through the tasks / jobs. Simply use .catch
or try catch
to handle them.
Even catch unhandled errors by listening for unhandledrejection
.
ts
import { job, task } from "@pandaci/core";
globalThis.addEventListener("unhandledrejection", (e) => {
// Catch all errors thrown in this workspace
});
await job("Throws error", () => {
task.native("Errors", () => {
$`throws error`.catch(() => {
// Handle
});
});
});