Skip to content

Control error reporting via a LocalizationProvider prop #411

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
stasm opened this issue Jul 29, 2019 · 2 comments · Fixed by #619
Closed

Control error reporting via a LocalizationProvider prop #411

stasm opened this issue Jul 29, 2019 · 2 comments · Fixed by #619

Comments

@stasm
Copy link
Contributor

stasm commented Jul 29, 2019

We should allow users to control exactly how formatting errors are handled in Localized and getString. We could do it via a <LocalizationProvider reportError={...}> prop, which is a function taking an error.

@akdetrick
Copy link

akdetrick commented Aug 3, 2022

I have a real world use case for this. It's common to configure production error reporting to ignore anything at warning level or below. This is an example of a function taking an error that would capture the key miss logging at error level:

const reportError = (fluentKeyMissWarning) => {
  Dashboard.withScope((scope) => {
    scope.setLevel("error");
    Dashboard.captureException(fluentKeyMissWarning);
  });
}

@brunottonurb
Copy link

I would like to be able to ignore missing id errors in some cases, to avoid logging them to the console. Is there a status update for this? AFAIK there is no way to do this yet.

StaberindeZA added a commit to StaberindeZA/fluent.js that referenced this issue Jul 31, 2023
Because:

* We should allow users to control if reportErrors are reported or not.

This commit:

* Adds a class property to ReactLocalization to enable/disable logging
  in reportErrors.
* Allows <LocalizationProvider> to enable/disable error reporting

Closes: projectfluent#411
StaberindeZA added a commit to StaberindeZA/fluent.js that referenced this issue Aug 1, 2023
Because:

* We should allow users the ability to provide a reportError function.

This commit:

* Adds a class property, reportError, to ReactLocalization that allows
  consumers to provide a function on initialization to report errors.
  By default the errors will console.warn.

Closes: projectfluent#411
StaberindeZA added a commit to StaberindeZA/fluent.js that referenced this issue Aug 1, 2023
Because:

* We should allow users the ability to provide a reportError function.

This commit:

* Adds a class property, reportError, to ReactLocalization that allows
  consumers to provide a function on initialization to report errors.
  By default the errors will console.warn.

Closes: projectfluent#411
eemeli pushed a commit that referenced this issue Aug 1, 2023
Because:

* We should allow users the ability to provide a reportError function.

This commit:

* Adds a class property, reportError, to ReactLocalization that allows
  consumers to provide a function on initialization to report errors.
  By default the errors will console.warn.

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

Successfully merging a pull request may close this issue.

3 participants