logDartError method
void
logDartError(
- String? stack,
- String? message,
- String? context,
- String? library, {
- String? errorType,
- bool wasHandled = false,
override
Sends information from a Dart error/exception to the host SDK so that a log can be delivered.
Implementation
@override
void logDartError(
String? stack,
String? message,
String? context,
String? library, {
String? errorType,
bool wasHandled = false,
}) {
// return silently instead of throwing a StateError - as throwing an
// exception during exception handling would likely cause an error loop.
if (!isStarted) {
return;
}
try {
methodChannel.invokeMethod(
_logDartErrorMethodName,
{
_errorStackArgName: stack,
_errorMessageArgName: message,
_errorContextArgName: context,
_errorLibraryArgName: library,
_errorTypeArgName: errorType,
_errorWasHandledArgName: wasHandled,
},
);
} catch (e) {
// avoid propagating any errors that could cause an error loop!
if (kDebugMode) {
print('Failed to send error to Embrace: $e');
}
}
}