Cordova: Catch native crash

We would like to catch native crash and JavaScript crash, so we will use Cordova.
https://docs.sentry.io/clients/cordova/

In Usage, this code is written in reference.

Sentry.captureMessage(‘message’);
try {
myFailingFunction();
} catch (e) {
Sentry.captureException(e);
}

I think this code is for catching JavaScript error.
What should I write for catching native crash error?
(Does nothing need to be done…?)

We catch native erros by default, so there is nothing to do :slight_smile:

Thank you.
I now feel easy.
I will integrate Cordova in our project.

I integrate sentry-cordova-0.10.2.zip on our project.
(We use Monaca platform)
When I build this project, errors show up in my logs.

----------------------build-log start-----------------------------

Fetching Build Queue Data…
-> Fetched data for queue ID 5b31ac77e78885ef1bdba6cf
Preparing Build Environment…
Creating Project Build Workspace…
Fetching Project Content…



Subproject Path: CordovaLib
Adding phonegap-plugin-push to package.json
Saved plugin info for “phonegap-plugin-push” to config.xml
Discovered plugin “sentry-cordova” in config.xml. Adding it to the project
Installing “sentry-cordova” for android
Error during processing of action! Attempting to revert…
Failed to install ‘sentry-cordova’: Error: Uh oh!
ENOENT: no such file or directory, open ‘/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/plugins/sentry-cordova/dist/js/sentry-cordova.bundle.js’
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at install (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/lib/pluginHandlers.js:173:36)
at ActionStack.process (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
at PluginManager.doOperation (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
at PluginManager.addPlugin (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
at /private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/Api.js:243:74
at _fulfilled (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/cordova/node_modules/q/q.js:816:13)
Failed to restore plugin “sentry-cordova” from config.xml. You might need to try adding it again. Error: Error: Uh oh!
ENOENT: no such file or directory, open ‘/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/plugins/sentry-cordova/dist/js/sentry-cordova.bundle.js’
Discovered plugin “mobi.monaca.plugins.debugger.android” in config.xml. Adding it to the project
Installing “mobi.monaca.plugins.debugger.android” for android
Subproject Path: CordovaLib
jp.co.athome.monaca.atAppProto
/private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project
Adding mobi.monaca.plugins.debugger.android to package.json
Saved plugin info for “mobi.monaca.plugins.debugger.android” to config.xml
Sentry: running after_plugin_add - set SENTRY_SKIP_WIZARD=true to skip this
cordova-custom-config: Applied custom config from config.xml to /private/tmp/monaca/5b31ac77e78885ef1bdba6cf/project/platforms/android/AndroidManifest.xml
–save flag or autosave detected
Saving android@/data/build-server/cordova/platforms/android/6.4.0 into config.xml file …
Sentry: running after_platform_add - set SENTRY_SKIP_WIZARD=true to skip this

  • postBuild -
    Build Error: Error: Sandbox Exec Error: [ package.json cordova-plugin-repro@3.6.2 license should be a valid SPDX license expression

Sentry - Warning


You’ve run this command with the ionic prefix
either run it without ‘ionic’ or do run:
$ sentry-wizard




Sentry - Warning


You’ve run this command with the ionic prefix
either run it without ‘ionic’ or do run:
$ sentry-wizard



]

------------------------build-log end-----------------------------

Are there are work-arounds for this problem?
cordova 7.1.0, My app uses Monaca/Angular6. Any help appreciated, thanks.

Sorry, I am not familiar with monaca but it seems like they are doing some magic while installing a normal npm module.
If you install sentry-cordova simply with npm you’ll get the dist folder containing dist/js/sentry-cordova.bundle.js the file monaca is complaining not finding.