Official link https://firebase.google.com/docs/crashlytics/
This method triggers an application crash.
window.FirebasePlugin.sendCrash();
It is used once to tell Firebase that Crashlitycs is configured. Its use is not recommended as it is not a true information in the Firebase panel. In fact it will appear as an error in the plugin line.
Log an error message into plugin file.
window.FirebasePlugin.logMessage("Error message", success, error);
In iOS log a message and it is an alias of logMessage. Android records an exception, but will always be displayed in the plugin's file line.
window.FirebasePlugin.logError("Error message", success, error);
- message: Typeof string and represent the error message
- stack: Type Array and represents the lines of the error stack. To get this information use this JavaScript library: StackTraceJS
- domain: Typeof string and represent the domain of error. Ex. "javascript"
Here under a use case:
window.addEventListener('error', (error)=>{
if ( window.FirebasePlugin && window.FirebasePlugin.sendNonFatalCrash ){
StackTrace.fromError(error).then((stack)=>{
console.log(error.message, stack);
window.FirebasePlugin.sendNonFatalCrash(error.message, stack, 'javascript');
});
}
});
In this case, the panel displays the javascript stack supplied as input from the library.
If you do not use a local webserver, the error received is: "Script Error." on line 0
, when the error occurs in a script that's hosted on a domain other than the domain of the current page.
To bypass this block disable the local file restrictions of WKWebview. Reference: https://bugs.webkit.org/show_bug.cgi?id=154916
<preference name="FirebasePluginAllowFileAccess" value="true" />
If set, it associates an error with a given user.
window.FirebasePlugin.setCrashlyticsUserId("userId", success, error);