Errors while executing compiler are not caught correctly
nandenjin opened this issue · 0 comments
nandenjin commented
How to reproduce
Use this loader without emsdk
Expected
An error will be thrown by utility.getDependencies()
.
Lines 24 to 30 in 2a3c0ba
What happened
It doesn't throw anything and returns an empty array. As a result, utility.getLatestModifiedTime()
throws an error:
ERROR in ./src/main.clist
Module build failed (from ../../emcc-loader/lib/index.js):
Error: paths must be non-empty.
at getLatestModifiedTime (/Users/nandenjin/workspace/emcc-loader/lib/index.js:63:15)
at Compiler.compile (/Users/nandenjin/workspace/emcc-loader/lib/index.js:230:42)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Compiler.process (/Users/nandenjin/workspace/emcc-loader/lib/index.js:203:30)
@ ./src/index.ts 12:0-34 30:22-39
How to fix
utility.execute()
is designed that it passes error as its return value instead of throwing it.
Lines 98 to 118 in 2a3c0ba
So, it may be fixed with detecting errors with return value instead of using .catch()