Browse Source

优化断网下的报错提示

master
YakumoChen 2 months ago
parent
commit
4f8d430575
4 changed files with 11 additions and 0 deletions
  1. 3
      .fvmrc
  2. 2
      .gitignore
  3. 3
      .vscode/settings.json
  4. 3
      lib/network/network_config.dart

3
.fvmrc

@ -0,0 +1,3 @@
{
"flutter": "3.35.2"
}

2
.gitignore

@ -30,3 +30,5 @@ doc/api/
/android/app/profile /android/app/profile
/android/app/release /android/app/release
# FVM Version Cache
.fvm/

3
.vscode/settings.json

@ -0,0 +1,3 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.35.2"
}

3
lib/network/network_config.dart

@ -145,6 +145,9 @@ class ResponseInterceptor extends Interceptor {
case DioExceptionType.cancel: case DioExceptionType.cancel:
errorMessage = '请求已取消'; errorMessage = '请求已取消';
break; break;
case DioExceptionType.connectionError:
errorMessage = '网络连接失败';
break;
default: default:
errorMessage = err.message ?? '未知错误'; errorMessage = err.message ?? '未知错误';
} }

Loading…
Cancel
Save