convertFromPlatformException function

CaptureException convertFromPlatformException(
  1. dynamic exception,
  2. String? method,
  3. String? type
)

Converting a platform exception to a generic CaptureException.

Implementation

CaptureException convertFromPlatformException(
    dynamic exception, String? method, String? type) {
  int code = 0;
  String message = 'No Message';
  if (exception is PlatformException) {
    code = int.parse(exception.code);
    message = exception.message ?? message;
  }
  return CaptureException(code, message, method, type);
}