onError method
Called when an exception was occurred during the request.
Implementation
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
String errorStr = "\n==================== Response ====================\n"
"- URL: ${err.requestOptions.baseUrl + err.requestOptions.path}\n"
"- METHOD: ${err.requestOptions.method}\n"
"- HEADER:\n${err.response?.headers.map.mapToString()}\n";
if (err.response != null && err.response?.data != null) {
errorStr += "- ERROR:\n${_parseResponse(err.response!)}\n";
} else {
errorStr += "- ERROR_TYPE: ${err.type}\n";
errorStr += "- ERROR_MSG: ${err.message}\n";
}
handler.next(err);
}