Skip to content

Throw on bundle.formatPattern if errors would be swallowed #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Pike opened this issue Jul 12, 2019 · 4 comments
Closed

Throw on bundle.formatPattern if errors would be swallowed #390

Pike opened this issue Jul 12, 2019 · 4 comments

Comments

@Pike
Copy link
Contributor

Pike commented Jul 12, 2019

bundle.format and soon, bundle.formatPattern swallow errors if you don't pass in an errors array.

We should throw on errors instead, I think.

@stasm
Copy link
Contributor

stasm commented Jul 15, 2019

Do you think we should:

  1. throw to complain that errors were not passed as an argument, or…
  2. change the error reporting mode and throw a special kind of error containing the array of collected errors?

@Pike
Copy link
Contributor Author

Pike commented Jul 15, 2019

... or ...

  1. throw the first error
  2. throw the last error

I'd not do 1, I didn't think about 2.

@eemeli
Copy link
Member

eemeli commented Jul 15, 2019

I'd vote for option 3. At that point, no matter what the specific error, showing some fallback string like the message key in the UI is probably at least pretty close to the least wrong thing to do, while printing the error in the console. If the library user wants to do something more complicated than that, that's exactly what the errors argument is for.

@stasm
Copy link
Contributor

stasm commented Jul 19, 2019

Fixed in #396 on the release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants