getResponseStatus function
Implementation
ResponseStatus? getResponseStatus(Exception e) {
if (e is WebServiceException) {
if (e.responseStatus != null) {
return e.responseStatus;
}
return ResponseStatus(
errorCode: "${e.statusCode}",
message: e.message ?? e.statusDescription);
}
String exStr = "$e";
bool hasExType = exStr.indexOf(':') >= 0;
String exType = hasExType
? leftPart(exStr, ':')!
: trimStart(e.runtimeType.toString(), '_');
String exMsg = hasExType ? rightPart(exStr, ':')! : exStr;
return ResponseStatus(errorCode: exType, message: exMsg);
}