spiegel-keyman/android/KMEA
Marc Durdin 0b64871be3 fix(web): improve console.error() reporting
The back story:

Currently Keyman for Android reports errors sent to the console via
`console.error()` into Sentry but sentry-manager itself does not. This
means that Keyman for iPhone and iPad and other users of sentry-manager
do not report these errors. Many of these errors are important.

What's worse is that Keyman for Android's error reporting here (via the
`sendKMWError()` function in Keyman Engine for Android) does not capture
stack traces, and so many of the errors we get do not have enough
information to resolve them.

Furthermore, by having `sendKMWError()` in Keyman for Android, we
capture exceptions and other program errors twice -- once on the web
side, and once on the Java side -- this adds noise to our error
reporting. Sentry also tends to lump many unrelated `sendKMWError()`
events together, so tracking resolution to the errors is painful.

The fix:

This adds a patch to sentry-manager to capture `console.error()` and
`console.warning()` events and report them through Sentry's normal error
reporting, and disables the `sendKMWError()` report (although we leave
the breadcrumb in place for when there are later, related Java errors).
There is a Sentry integration called CaptureConsole, but it does not
support capturing stack traces until v6.14
(https://github.com/getsentry/sentry-javascript/pull/4034). Updating
Sentry to 6.14 or newer is a bigger job (due to ES6 baseline req. etc.)

Note that Keyman for iOS currently has some other stubs in place
overriding the `console.*` functions. These should be removed for
release builds, so that we can use this pattern instead. I will try and
tackle this in a follow-up PR (I will build it on my mac so I can test
it).

A sample error report captured with this mechanism (no sourcemaps here
because this is a -local build):

https://sentry.io/organizations/keyman/issues/3401287467/events/c40fd2cebb7743cc8dfe72e0dd34bf65/?project=5983524

I am proposing we back-port this to 15.0-stable as we are missing a lot
of data in many of our error reports on Android.
2022-07-05 10:57:42 +10:00
..
app fix(web): improve console.error() reporting 2022-07-05 10:57:42 +10:00
gradle/wrapper chore(android): Upgrade gradle-wrapper version to 6.8 2022-02-09 08:59:56 +07:00
test_resources fix(android/engine): Fix zip slip vulnerability 2021-01-20 15:42:22 +07:00
.classpath Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
build.gradle fix(android/engine): Skip tests for missing resource errors 2021-05-18 12:00:32 +07:00
build.sh chore(android): build now includes es6-shim polyfill 2022-05-31 09:30:52 +07:00
gradle.properties chore(android/engine): Update dependencies 2021-05-18 10:08:05 +07:00
gradlew fix(android): Update Gradle wrapper to 5.6.4 2020-08-07 08:51:01 +07:00
gradlew.bat fix(android): Update Gradle wrapper to 5.6.4 2020-08-07 08:51:01 +07:00
lint.xml Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
proguard-project.txt Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
project.properties Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
settings.gradle Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00