Skip to content

Commit 1d3ab39

Browse files
authored
fix: show ts error on loadFile (#282)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling for file loading to provide better error visibility and logging. - Enhanced error message construction to include more context when file loading fails. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 82ef277 commit 1d3ab39

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ export default {
8484
const obj = await importModule(filepath, { importDefaultOnly: true });
8585
return obj;
8686
} catch (e: any) {
87+
if (!e.message && typeof e !== 'string') {
88+
// ts error: test/fixtures/apps/app-ts/app/extend/context.ts(5,17): error TS2339: Property 'url' does not exist on type 'Context'
89+
console.trace(e);
90+
throw e;
91+
}
8792
const err = new Error(`[@eggjs/core] load file: ${filepath}, error: ${e.message}`);
8893
err.cause = e;
8994
debug('[loadFile] handle %s error: %s', filepath, e);

0 commit comments

Comments
 (0)