onError method
Called when an exception was occurred during the request.
Implementation
@override
void onError(DioException err, ErrorInterceptorHandler handler) async {
if (showLogging) {
if (kDebugMode) {
print(
'OS BASECODE - ERROR[${err.response?.statusCode}] => PATH: ${err.requestOptions.path}');
print('OS BASECODE - FULL ERROR: ${err.toString()}');
print('OS BASECODE - ERROR MESSAGE : ${err.message}');
print('OS BASECODE - ERROR TRACE : ${err.stackTrace}');
}
}
handleOnError(err, handler);
if (err.response?.statusCode == 401) {
handleWhenUnauthorized();
}
return super.onError(err, handler);
}