KindeError.fromError constructor
KindeError.fromError(
- Object error,
- StackTrace stackTrace
Factory constructor that converts any Object error to a KindeError.
Uses pattern matching with switch expressions for type-safe error handling. Delegates specific error types to appropriate handler functions. Preserves stack traces for debugging.
Implementation
factory KindeError.fromError(Object error, StackTrace stackTrace) => switch (error) {
KindeError e => e,
PlatformException e => _flutterAppAuthExceptionMapper(e, stackTrace),
AuthorizationException e => AuthorizationKindeError.fromOauth2Exception(e, stackTrace),
FormatException e => _handleFormatException(e, stackTrace),
Exception e => _handleError(e, stackTrace),
_ => KindeError(message: error.toString(), stackTrace: stackTrace),
};