Skip to content

Commit

Permalink
feat: introduce resumable errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shah committed Dec 30, 2023
1 parent e01083c commit 45e4625
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pattern/ingest/duckdb/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ export function ingestSqlRegister(): IngestSqlRegister {
};
}

export class IngestResumableError extends Error {
constructor(readonly issue: string, cause?: Error) {
super(issue);
if (cause) this.cause = cause;
}
}

export interface IngestArgs<Governance extends IngestGovernance, Notebook> {
readonly sqlRegister: IngestSqlRegister;
readonly emitDagPuml?:
Expand Down Expand Up @@ -643,7 +650,11 @@ export async function ingest<
" ",
),
);
console.error({ cell, error });
if (error instanceof IngestResumableError) return "continue";

// unless the error is resumable, show error and abort
console.error(`[Non-resumable issue in '${cell}']`, error);
return "abort";
};
rsEE.afterCell = (cell, _result, _ctx) => {
registerStateChange(`ENTER(${cell})`, `EXIT(${cell})`);
Expand Down

0 comments on commit 45e4625

Please sign in to comment.