Skip to content

Commit

Permalink
Correct ParseExceptionResult
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Sep 29, 2024
1 parent dcfb219 commit 5ba014d
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions openrewrite/src/core/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,19 @@ export class ParseExceptionResult implements Marker {
private readonly _id: UUID;
private readonly _parserType: string;
private readonly _exceptionType: string;
private readonly _exceptionMessage: string;
private readonly _message: string | null;
private readonly _treeType: string | null;

constructor(
id: UUID,
parserType: string,
exceptionType: string,
exceptionMessage: string,
message: string | null,
treeType?: string | null
) {
this._id = id;
this._parserType = parserType;
this._exceptionType = exceptionType;
this._exceptionMessage = exceptionMessage;
this._message = message;
this._treeType = treeType ?? null;
}
Expand All @@ -137,8 +134,7 @@ export class ParseExceptionResult implements Marker {
randomId(),
parser.constructor.name,
exception.constructor.name,
exception.stack || exception.message || '',
null // Assuming message can be null
exception.stack || exception.message || ''
);
}

Expand All @@ -151,7 +147,6 @@ export class ParseExceptionResult implements Marker {
id,
this._parserType,
this._exceptionType,
this._exceptionMessage,
this._message,
this._treeType
);
Expand All @@ -166,7 +161,6 @@ export class ParseExceptionResult implements Marker {
this._id,
parserType,
this._exceptionType,
this._exceptionMessage,
this._message,
this._treeType
);
Expand All @@ -181,22 +175,6 @@ export class ParseExceptionResult implements Marker {
this._id,
this._parserType,
exceptionType,
this._exceptionMessage,
this._message,
this._treeType
);
}

get exceptionMessage(): string {
return this._exceptionMessage;
}

withExceptionMessage(exceptionMessage: string): ParseExceptionResult {
return exceptionMessage === this._exceptionMessage ? this : new ParseExceptionResult(
this._id,
this._parserType,
this._exceptionType,
exceptionMessage,
this._message,
this._treeType
);
Expand All @@ -211,7 +189,6 @@ export class ParseExceptionResult implements Marker {
this._id,
this._parserType,
this._exceptionType,
this._exceptionMessage,
message,
this._treeType
);
Expand All @@ -226,9 +203,8 @@ export class ParseExceptionResult implements Marker {
this._id,
this._parserType,
this._exceptionType,
this._exceptionMessage,
this._message,
this._treeType
treeType
);
}
}

0 comments on commit 5ba014d

Please sign in to comment.