Skip to content

Commit efdeaea

Browse files
committed
small rewrite
1 parent 030290b commit efdeaea

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/compound.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export class ResultError extends Error {
66
isHtml: boolean;
77
override name = "ArrayResultError";
88
constructor(message: string, options: Partial<ResultErrorOptions> = {}) {
9-
super(message, { cause: options.cause });
10-
this.isHtml = options.isHtml ?? false;
9+
const { cause, isHtml = false } = options;
10+
super(message, { cause });
11+
this.isHtml = isHtml;
1112
}
1213
}
1314
export class TodoError extends ResultError {

src/parser/parser_lib.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ export class Parser<T> {
8787
}
8888
export type Position = Readonly<{ position: number; length: number }>;
8989
export class PositionedError extends ResultError {
90-
public position: null | Position;
9190
override name = "PositionedError";
92-
constructor(message: string, position?: Position) {
91+
constructor(message: string, public readonly position: null | Position = null) {
9392
super(message);
94-
this.position = position ?? null;
9593
}
9694
}
9795
function withPositionedError<T>(fn: () => T, position: Position) {

0 commit comments

Comments
 (0)