feat: 网络错误弹窗添加更多信息;减少显示时间

This commit is contained in:
orz12
2024-07-07 15:19:52 +08:00
parent dd0975a7ec
commit 570e4d15ff

View File

@@ -47,11 +47,12 @@ class ApiInterceptor extends Interceptor {
// handler.next(err);
String url = err.requestOptions.uri.toString();
print('🌹🌹ApiInterceptor: $url');
if (!url.contains('heartbeat')) {
// 屏蔽弹幕和心跳请求的错误提示
if (!url.contains('heartbeat') && !url.contains('seg.so')) {
SmartDialog.showToast(
await dioError(err),
await dioError(err) + url,
displayType: SmartToastType.onlyRefresh,
displayTime: const Duration(milliseconds: 1500),
displayTime: const Duration(milliseconds: 1200),
);
}
super.onError(err, handler);
@@ -75,7 +76,7 @@ class ApiInterceptor extends Interceptor {
return '发送请求超时,请检查网络设置';
case DioExceptionType.unknown:
final String res = await checkConnect();
return '$res,网络异常!';
return '$res${error.error} ${error.message} 网络异常!';
}
}