getHycopException static method
Implementation
static HycopException getHycopException({
dynamic error,
required String defaultMessage,
int? code,
}) {
String defMsg;
if (error is HycopException) {
return error;
} else if (error is FirebaseException) {
FirebaseException ex = error;
defMsg = '${ex.message} (${ex.code}:$defaultMessage)';
} else if (error is Exception) {
Exception ex = error;
defMsg = '$defaultMessage (${ex.toString()})'; //ex.toString();
} else {
defMsg = defaultMessage;
}
return HycopException(
message: defMsg,
exception: (error is Exception) ? error : Exception(error.toString()),
code: code,
);
}