DescopeException class
The concrete type of Exception
thrown by all operations in the Descope SDK.
There are several ways to catch and handle a DescopeException
thrown by a Descope SDK
operation, and you can use whichever one is more appropriate in each specific use case.
try {
final authResponse = await Descope.otp.verify(method: DeliveryMethod.email, loginId: loginId, code: code);
final session = DescopeSession.fromAuthenticationResponse(authResponse);
} on DescopeException catch (e) {
switch(e) {
case DescopeException.wrongOTPCode:
case DescopeException.invalidRequest:
showBadCodeAlert();
break;
case DescopeException.networkError:
showNetworkErrorRetry();
break;
default:
showUnexpectedErrorAlert(with: e);
}
}
- Implemented types
Constructors
- DescopeException({required String code, required String desc, String? message, dynamic cause})
-
const
Properties
- cause → dynamic
-
An optional underlying error that caused this error.
final
- code → String
-
A string of 7 characters that represents a specific Descope error.
final
- desc → String
-
A short description of the error message.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- message → String?
-
An optional message with more details about the error.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- badRequest → const DescopeException
- enchantedLinkExpired → const DescopeException
- enchantedLinkPending → const DescopeException
- flowCancelled → const DescopeException
- flowFailed → const DescopeException
- flowSetup → const DescopeException
- invalidArguments → const DescopeException
- invalidRequest → const DescopeException
- missingArguments → const DescopeException
- networkError → const DescopeException
- Thrown when a call to the Descope API fails due to a network error.
- oauthNativeCancelled → const DescopeException
- oauthNativeFailed → const DescopeException
- passkeyCancelled → const DescopeException
- passkeyFailed → const DescopeException
- tooManyOTPAttempts → const DescopeException
- wrongOTPCode → const DescopeException