Kode / kmake

Meta build system
Other
12 stars 14 forks source link

Feature Request: Improved Error messages #50

Open tcdude opened 1 year ago

tcdude commented 1 year ago

Whenever an error happens in kmake, the resulting error message doesn't include the offending kfile.js + line number that caused the error.

One typically gets an error along these lines:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:372:5)
    at validateString (node:internal/validators:119:11)
    at Object.resolve (node:path:167:9)
    at node:kmake/Project:106:45
    at new Promise (<anonymous>)
    at loadProject (node:kmake/Project:73:12)
    at Project.addProject (node:kmake/Project:663:31)
    at eval (eval at <anonymous> (node:kmake/Project:109:27), <anonymous>:15:35)
    at node:kmake/Project:109:278
    at new Promise (<anonymous>) {
  code: 'ERR_INVALID_ARG_TYPE'
}
Error: kfile did not call resolve, no project created.
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

The error shows where it happens in kmake, but it originates as anonymous promise which makes it hard to determine where it originated in my kfile.js

The requested feature would ideally show the respective kfile.js + line number that triggered the exception. Not sure if it is even possible, but any approximation would already be a big improvement imho.