adaptErrors function

Never adaptErrors({
  1. required Object error,
  2. required StackTrace stackTrace,
})

method used to adapt the error from the platform interface

Implementation

Never adaptErrors({
  required Object error,
  required StackTrace stackTrace,
}) {
  if (error is EmailAlreadyInUseExceptionInterface) {
    throw EmailAlreadyInUseException();
  }
  if (error is InvalidEmailOrPasswordExceptionInterface) {
    throw InvalidEmailOrPasswordException();
  }
  if (error is InvalidVerificationCodeExceptionInterface) {
    throw InvalidVerificationCodeException();
  }
  if (error is UpdateSamePasswordExceptionInterface) {
    throw UpdateSamePasswordException();
  }
  if (error is InvalidGrantCodeExceptionInterface) {
    throw InvalidGrantCodeException();
  }
  if (error is UserCancelledOrClosedTheWebFlowCodeExceptionInterface) {
    throw UserCancelledOrClosedTheWebFlowCodeException();
  }
  if (error is SocialAccountEmailAlreadyInUseExceptionInterface) {
    throw SocialAccountEmailAlreadyInUseException();
  }
  if (error is UnauthorizedRefreshTokenExceptionInterface) {
    throw UnauthorizedRefreshTokenException();
  }
  Error.throwWithStackTrace(error, stackTrace);
}