Files

21 lines
533 B
Dart
Raw Permalink Normal View History

2023-06-25 11:50:55 +08:00
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'http_exceptions.dart';
/// 错误处理拦截器
class ErrorInterceptor extends Interceptor {
Duration durationTime = Duration(seconds: 2);
@override
onError(DioError err, ErrorInterceptorHandler handler) {
// error统一处理
DioHttpException appException = DioHttpException.create(err);
// 错误提示
print('DioError===: ${appException.toString()}');
2024-07-01 15:26:49 +08:00
// err.error = appException;
2023-06-25 11:50:55 +08:00
super.onError(err, handler);
}
}