mjml icon indicating copy to clipboard operation
mjml copied to clipboard

mjml swallow my errors

Open bertho-zero opened this issue 3 years ago • 2 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Create a mjml component with a require that is missing in dependencies.

If I have a missing dependency in my component, mjml tells me that it is my component that is missing because it is also MODULE_NOT_FOUND error.

Expected behavior Should display the error.

Due to: https://github.com/mjmlio/mjml/blob/5e3af3194d2d0afa0ea8f6bea19c676889e2f5e0/packages/mjml-core/src/helpers/mjmlconfig.js#L112-L114

bertho-zero avatar Mar 22 '22 11:03 bertho-zero

You mean that you want to rethrow the error instead of just logging it ?

Maybe we should add an extra option to just crash if there's an issue with MJML Config ?

iRyusa avatar Mar 30 '22 11:03 iRyusa

No, logging is enough, the problem is that the actual log is wrong and lack of info to debug in my case, the component exists but it requires a dependency that I forgot. We can also check if the error message contains the resolvedPath in addition to checking the code. This will allow passing in the else in the case of a user error, it would display the error which could help to understand the error.

https://github.com/mjmlio/mjml/blob/5e3af3194d2d0afa0ea8f6bea19c676889e2f5e0/packages/mjml-core/src/helpers/mjmlconfig.js#L114-L120

bertho-zero avatar Mar 30 '22 16:03 bertho-zero