opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
22 stars 0 forks source link

Gracefully handle Project Errors #156

Closed LorisSigrist closed 2 weeks ago

LorisSigrist commented 2 weeks ago

Context

Currently paraglide crashes on any Project errors.

Proposal

Only crash if the plugins responsible for loading messages fail to load.

samuelstroschein commented 2 weeks ago

this does not seem to be a paraglide issue. the inlang sdk should have a project.errors or project.exceptions property that contains non-critical errors (like a module not loading).

paraglide could then decide to throw if a project has exceptions, or continue running

LorisSigrist commented 2 weeks ago

Depending on the app different things may count as "exceptions" vs "errors".

In Paraglide only a Plugin not loading would be fatal, whereas in Sherlock a function-matcher might count as "fatal". Future apps will have completely different requirements.

Giving apps a clear, well typed picture of what went wrong & having them react appropriately would be more flexible. This avoids turning the "exception" vs "error" discussion into another SDK topic.

Do you agree?

samuelstroschein commented 2 weeks ago

Yes, expose everything under project.errors() and let apps decide for themselves if they throw or not.

Clarification: I did not mean to separate errors and exceptions. I just forgot that we already exposed project.errors :)