Sentry errors appear localised, a regression?

Hello Sentry community :slight_smile:

After setting up the JavaScript Sentry SDK on a few web projects, I realised quite a few reported errors are localised in the language of the user to whom the error happened.

A few Google searches yielded 2 links about this issue:

So it seems that what I’m encountering should theoretically not be happening.

I could not find much in the docs about this.

Could it be that newer versions of the browsers now throw the errors in the locale of the user? Or is that a regression on Sentry’s side?

Looking forward to hearing from you!

Thanks!

Hello Robin,

IE and some other browsers have been throwing errors in the locale of the user for quite some time, and since that blogpost we are translating those error messages back. The code is here: https://github.com/getsentry/sentry/blob/cef6a960cfa3d08d1631cef4763c4ba7e2e1ca07/src/sentry/lang/javascript/errorlocale.py and the dataset is added here: https://github.com/getsentry/sentry/pull/6709

What most likely happened is that IE added a new error message that we didn’t import yet. So in order to confirm that is the case I think we need the concrete error message that we don’t have a translation for.

Thanks,

Markus

Hello Markus,

Thanks for your reply!

The errors that I’ve been seeing actually come from different browsers, like Safari Mobile, Chrome Mobile, Edge, etc.

After reviewing the localised errors I am reporting about, they all seem to be related to Network related issues, like “lost connection”, “could not contact host”, etc.

This sample code replicates the issue:

try {
  fetch("http://non-existent-url.unknown.tld").then(...)
} catch (error) {
  throw error
}

It propagated a localised error to Sentry, since the browser would show localised errors for its native APIs I believe. For example:

  • in Chrome in English: TypeError: Failed to fetch
  • in Mobile Safari in French: TypeError: Aucun serveur ayant le nom d’hĂ´te prĂ©cisĂ© n’a Ă©tĂ© dĂ©tectĂ©.

So this is most likely a poor implementation on our side. :see_no_evil:

I will resolve this forum entry.

Thanks again for your answer!

Robin

EDIT

fetch("http://non-existent-url.unknown.tld").then(...).catch(error => {
  Sentry.captureException(error)
})

That piece of code, which looks more reasonable to an extent, actually seems to produce the same result of showing localised errors.

Here’s a reproduction example that you can test as well:

The iOS emulator is running in French locale (the error is triggered by pressing on the aptly named “Trigger error” button)

with corresponding event in my Sentry dashboard: https://sentry.io/share/issue/48d31db3d3f24841990e8c92502321eb/#exception

Right, that’s expected behavior to some extent. What I was trying to say is that, since we have our own copy of the translation database, adding support for more kinds of error messages (esp. from other browsers) is more of a feature request than a bug.

That makes sense, absolutely.

I guess I was not sure anymore if this was meant to be covered by Sentry or not, so I did not know how to call it :slight_smile:

Do I understand correctly that the code you linked to translate error messages is applied to all Sentry error reports coming from the JavaScript SDK, regardless of the browser?

In that case, I suppose adding the missing translations for those I could see from Mobile Safari would be a feature request. Do we open these feature request directly from GitHub or there is another preferred channel? Please let me know if I can help (e.g. by providing a list of the localised errors I could find in my Sentry project).

Thanks a lot Markus :slight_smile:

Robin, feel free to open a GitHub issue or even contribute a PR, much appreciated!
Thanks!