onError method
Handles errors during HTTP requests.
Logs error details including request method, path, error type, and message.
Implementation
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
final options = err.requestOptions;
final requestPath = '${options.baseUrl}${options.path}';
// Log error details:
// - Request method and path
logDebug('onError: ${options.method} request => $requestPath',
level: LogLevel.error);
// - Error type and message
logDebug('onError: ${err.error}, Message: ${err.message}',
level: LogLevel.debug);
logDebug(_lineChar);
logDebug('\n');
return super.onError(err, handler);
}