INNER CODE UNIT · Dart

handleException

jhflovehqy/flutter_bolg_manage · lib/http/http_exception.dart:25

  static NetError handleException(DioError error) {
    if (error is DioError) {
      if (error.type == DioErrorType.response) {
        dynamic e = error.message;
        if (e is SocketException) {
          return NetError(socketError, '网络异常,请检查你的网络!');
        }
        if (e is HttpException) {
          return NetError(httpError, '服务器异常!');
        }
        if (e is FormatException) {
          return NetError(parseError, '数据解析错误!');
        }
        return NetError(netError, '网络异常,请检查你的网络!');
      } else if (error.type == DioErrorType.connectTimeout ||
          error.type == DioErrorType.receiveTimeout) {
        ///  连接超时 || 请求超时 || 响应超时
        return NetError(timeoutError, '连接超时!');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…