Skip to content

Commit

Permalink
fix: πŸ› don't mutate error object in-place
Browse files Browse the repository at this point in the history
This avoids mutating error thrown by an expression function in-place.
The error might not even be an object, in which case mutating it will
throw.
  • Loading branch information
streamich committed Feb 25, 2020
1 parent 1a96ff3 commit e4634c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/expressions/common/execution/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ export class Execution<
input = output;
} catch (rawError) {
const timeEnd: number = this.params.debug ? performance.now() : 0;
rawError.message = `[${fnName}] > ${rawError.message}`;
const error = createError(rawError) as ExpressionValueError;
error.error.message = `[${fnName}] > ${error.error.message}`;

if (this.params.debug) {
(link as ExpressionAstFunction).debug = {
Expand Down

0 comments on commit e4634c4

Please sign in to comment.