opral / inlang-paraglide-js

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

Gracefully handle Project Errors #156

Closed LorisSigrist closed 5 months ago

LorisSigrist commented 5 months ago

Context

Currently paraglide crashes on any Project errors.

Proposal

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

samuelstroschein commented 5 months 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 5 months 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 5 months 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 :)