Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/frank-terms-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@openfn/engine-multi': patch
'@openfn/ws-worker': patch
---

When reporting compilation errors, prefer the step name to the id
2 changes: 1 addition & 1 deletion packages/engine-multi/src/worker/thread/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async (
job.sourceMap = result.map;
job.expression = result.code;
} catch (e) {
throw new CompileError(e, job.id!);
throw new CompileError(e, job.name ?? job.id!);
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions packages/engine-multi/test/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ test.before(async () => {
engine = await createEngine(options);
});

test.serial('reporting: prefer step name to step id', (t) => {
return new Promise((done) => {
const plan = {
id: 'a',
workflow: {
steps: [
{
id: 'x',
name: 'My Step',
expression: 'a a a',
},
],
},
options: {},
};

engine.execute(plan, {}).on(WORKFLOW_ERROR, (evt) => {
t.is(evt.message, 'My Step: Unexpected token (1:2)');
done();
});
});
});

// This should exit gracefully with a compile error
test.serial('syntax error: missing bracket', (t) => {
return new Promise((done) => {
Expand Down