UnexpectedException constructor

UnexpectedException({
  1. String? userMessage,
  2. String? devMessage,
  3. Object? cause,
  4. StackTrace? stack,
  5. Map<String, dynamic> metadata = const {},
  6. Severity severity = Severity.error,
  7. bool isReportable = true,
})

Creates a catch-all exception when no specific domain type applies.

Implementation

UnexpectedException({
  String? userMessage,
  String? devMessage,
  super.cause,
  super.stack,
  Map<String, dynamic> metadata = const {},
  super.severity,
  super.isReportable,
}) : super(
        userMessage: userMessage ?? 'An unexpected error occurred.',
        devMessage: devMessage ?? 'Unexpected error.',
        metadata: {
          'errorType': cause?.runtimeType.toString(),
          'originalError': cause?.toString(),
          ...metadata,
        },
      );