convertFirebaseFunctionsException function
FirebaseFunctionsException
convertFirebaseFunctionsException(
- JSObject exception, [
- StackTrace? stackTrace
Given a web error, a FirebaseFunctionsException is returned.
Implementation
FirebaseFunctionsException convertFirebaseFunctionsException(
JSObject exception, [
StackTrace? stackTrace,
]) {
String originalCode = _stringProperty(exception, 'code') ?? 'unknown';
String code = originalCode.replaceFirst('functions/', '');
String message = (_stringProperty(exception, 'message') ?? '').replaceFirst(
'($originalCode)',
'',
);
return FirebaseFunctionsException(
code: code,
message: message,
stackTrace: stackTrace,
details: exception.getProperty('details'.toJS)?.dartify(),
);
}