Skip to content

Commit 8e36092

Browse files
committed
Wrap JSON parse errors in cloneObject with context
1 parent 2294a7a commit 8e36092

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/util.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,11 @@ export enum BuildMode {
10431043
}
10441044

10451045
export function cloneObject<T>(obj: T): T {
1046-
return JSON.parse(JSON.stringify(obj)) as T;
1046+
try {
1047+
return JSON.parse(JSON.stringify(obj)) as T;
1048+
} catch (err) {
1049+
throw new Error(`Cloning object failed: ${getErrorMessage(err)}`);
1050+
}
10471051
}
10481052

10491053
export async function cleanUpPath(file: string, name: string, logger: Logger) {

0 commit comments

Comments
 (0)