Throw multiple errors together? #973
plocket
started this conversation in
Improving clarity
Replies: 1 comment
-
Maybe, using the linked code as a model, Edit: That would mean potentially creating a new error which might give it a new stack trace. Do we want to add a multi-error class instead? Or in addition? The caller could create it to keep the stack trace relevant and This adds a fair amount more complexity than it first seemed. It may not be worth it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We sometimes accumulate errors. Right now we're logging them as warnings before throwing a more general error later and saying "see above for warnings and errors". Would it be more clear to throw them all at once?
https://github.com/matthewmueller/combine-errors/blob/master/index.js says it lets you throw multiple errors in a pretty way. It depends on a lib for custom errors that I think we don't need right now. It's pretty simple and I think we could replicate the part we need (with credit to the original author).
Is that worth doing? Is it really more clear?
Beta Was this translation helpful? Give feedback.
All reactions