Skip to content

Commit

Permalink
fix(core): after slangroom statement execution throw an error if res.…
Browse files Browse the repository at this point in the history
…ok is set to false (#97)
  • Loading branch information
matteo-cristino authored Mar 6, 2024
1 parent 423770f commit 65e75d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/core/src/slangroom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class Slangroom {
const exec = this.#plugins.get(ast.key);
if (!exec) throw new Error('no statements matched');
const res = await exec(new PluginContextImpl(ast));
if (!res.ok) throw new Error(res.error);
if (res.ok && ast.into) paramsGiven.data[ast.into] = res.value;
}

Expand All @@ -90,6 +91,7 @@ export class Slangroom {
const exec = this.#plugins.get(ast.key);
if (!exec) throw new Error('no statements matched');
const res = await exec(new PluginContextImpl(ast));
if (!res.ok) throw new Error(res.error);
if (res.ok && ast.into) paramsThen.data[ast.into] = res.value;
}

Expand Down

0 comments on commit 65e75d3

Please sign in to comment.