This commit introduces a custom error object to provide additional context for errors throwing during parsing and compiling operations, improving troubleshooting. By integrating error context handling, the error messages become more informative and user-friendly, providing sequence of trace with context to aid in troubleshooting. Changes include: - Introduce custom error object that extends errors with contextual information. This replaces previous usages of `AggregateError` which is not displayed well by browsers when logged. - Improve parsing functions to encapsulate error context with more details. - Increase unit test coverage and refactor the related code to be more testable.
18 lines
418 B
TypeScript
18 lines
418 B
TypeScript
import type { IScriptCode } from '@/domain/IScriptCode';
|
|
|
|
export class ScriptCodeStub implements IScriptCode {
|
|
public execute = `[${ScriptCodeStub.name}] default execute code`;
|
|
|
|
public revert = `[${ScriptCodeStub.name}] default revert code`;
|
|
|
|
public withExecute(code: string) {
|
|
this.execute = code;
|
|
return this;
|
|
}
|
|
|
|
public withRevert(revert: string) {
|
|
this.revert = revert;
|
|
return this;
|
|
}
|
|
}
|