Skip to content

Commit

Permalink
fix: strict type caught error (#253)
Browse files Browse the repository at this point in the history
* fix: strict type catch error
* chore: update typescript-estree packages
  • Loading branch information
toomuchdesign committed Sep 2, 2021
1 parent 6e912ef commit 9eebd83
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 46 deletions.
196 changes: 156 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions src/page/getPageFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ export function getPageFileIfExists<FileType>({

try {
return loadFile({ absolutePath });
} catch (e) {
const internalError = new InternalError(
`Failed to load "${pagePath}" file due to ${e.name}: ${e.message}`
);
internalError.stack = e.stack;
throw internalError;
} catch (e: unknown) {
/* istanbul ignore else */
if (e instanceof Error) {
const internalError = new InternalError(
`Failed to load "${pagePath}" file due to ${e.name}: ${e.message}`
);
internalError.stack = e.stack;
throw internalError;
} else {
throw new InternalError(`Failed to load "${pagePath}"`);
}
}
}

0 comments on commit 9eebd83

Please sign in to comment.