handleCommonError<T> function
Handles common errors and returns the appropriate ApiException.
Implementation
ApiException handleCommonError<T>(Object exception, StackTrace stacktrace) {
if (exception is FormatException ||
exception.toString().contains('is not a subtype of')) {
return ParseException(
message: exception.toString(),
stackTrace: stacktrace,
);
}
return ServerException(
message: exception.toString(),
stackTrace: stacktrace,
);
}