[Feature Request]: expose error information on JS API error object
What problem does this feature solve?
When there is an error from API-based usage, e.g. a missing export:
try {
const bundle = await rolldown({
input: '...'
})
const generated = await bundle.generate({ format: 'cjs' })
} catch (e) {
console.log(e) // e doesn't expose anything useful
}
The error message is printed to the console, but the caught error object doesn't contain the same information. e.message is "Build failed" and e.code is "GenericFailure" - which are not really helpful.
What does the proposed API look like?
e.message and e.code should contain more specific information.
I think this one is solved. Errors returned from rust or caught in Js would be displayed as it is.
--- edited
looks like there are much to be improved
looks like there are much to be improved
Would you clarify this?
looks like there are much to be improved
Would you clarify this?
I reopen it becuase of reqeust I saw in https://github.com/rolldown/rolldown/issues/2734.
It seemed it was suggesting add more specific fields to the each individual error object.
I see. Warnings support id and exporter property (https://github.com/rolldown/rolldown/pull/3711).
I think we can close this issue once we support id, exporter, loc, pos.
related code: https://github.com/rolldown/rolldown/blob/06f24c0bc72d8700fec4563a97aa730510d2023c/crates/rolldown_binding/src/types/error/native_error.rs#L4-L7
#7341