isFirebaseFunctionsError function

bool isFirebaseFunctionsError(
  1. Object? error
)

Whether error is a JS error from the Functions SDK, that is a JS object with a string code.

Dart errors and other JS errors return false and should be rethrown as they are.

Implementation

bool isFirebaseFunctionsError(Object? error) {
  // `is JSObject` is false for Dart objects on both dart2js and dart2wasm.
  // ignore: invalid_runtime_check_with_js_interop_types
  return error is JSObject && error.getProperty('code'.toJS).isA<JSString>();
}