CometChatCallsException.wrapUnhandled constructor
CometChatCallsException.wrapUnhandled(
- dynamic exception
Wraps any exception in a CometChatCallsException with ERROR_UNHANDLED_EXCEPTION code. This ensures all unhandled exceptions are properly wrapped with consistent structure.
Requirements: 10.4
Example:
try {
// some operation
} catch (e) {
onError(CometChatCallsException.wrapUnhandled(e));
}
Implementation
factory CometChatCallsException.wrapUnhandled(dynamic exception) {
// If it's already a CometChatCallsException, return it as-is
if (exception is CometChatCallsException) {
return exception;
}
return CometChatCallsException(
ErrorCodeConstants.errorUnhandledException,
ErrorMessageConstants.messageUnhandledException,
exception.toString(),
);
}