Skip to content

Commit

Permalink
chore(utils): throw detailed error for register transform (#10590)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc authored Feb 23, 2023
1 parent 0be5d13 commit 488f056
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/utils/src/register.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { extname } from 'path';
import { addHook } from '../compiled/pirates';
import { logger } from './index';

const COMPILE_EXTS = ['.ts', '.tsx', '.js', '.jsx'];
const HOOK_EXTS = [...COMPILE_EXTS, '.mjs'];
Expand All @@ -23,7 +24,8 @@ function transform(opts: { code: string; filename: string; implementor: any }) {
logLevel: 'error',
}).code;
} catch (e) {
throw new Error(`Parse file failed: [${filename}]`, { cause: e });
logger.error(e);
throw new Error(`Parse file failed: [${filename}]`);
}
}

Expand Down

0 comments on commit 488f056

Please sign in to comment.