Skip to content

Commit 7ddd0b1

Browse files
authored
Update DioError
1 parent fdf3827 commit 7ddd0b1

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README-ZH.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ dio.interceptors.add(InterceptorsWrapper(
399399

400400
```dart
401401
tokenDio = Dio(); //Create a instance to request the token.
402-
tokenDio.options = dio;
402+
tokenDio.options = dio.options;
403403
dio.interceptors.add(InterceptorsWrapper(
404404
onRequest:(Options options) async {
405405
// If no token, request token firstly and lock this interceptor
@@ -503,11 +503,12 @@ dio.interceptors.add(LogInterceptor(responseBody: false)); //开启请求日志
503503

504504
```dart
505505
{
506-
/// 响应信息, 如果错误发生在在服务器返回数据之前,它为 `null`
507-
Response response;
506+
/// Request info.
507+
RequestOptions request;
508508
509-
/// 错误描述.
510-
String message;
509+
/// Response info, it may be `null` if the request can't reach to
510+
/// the http server, for example, occurring a dns error, network is not available.
511+
Response response;
511512
512513
/// 错误类型,见下文
513514
DioErrorType type;
@@ -521,21 +522,21 @@ dio.interceptors.add(LogInterceptor(responseBody: false)); //开启请求日志
521522

522523
```dart
523524
enum DioErrorType {
524-
/// When opening url timeout, it occurs.
525+
/// It occurs when url is opened timeout.
525526
CONNECT_TIMEOUT,
526527
527-
/// Whenever more than [receiveTimeout] (in milliseconds) passes between two events from response stream,
528-
/// [Dio] will throw the [DioError] with [DioErrorType.RECEIVE_TIMEOUT].
529-
///
530-
/// Note: This is not the receiving time limitation.
528+
/// It occurs when url is sent timeout.
529+
SEND_TIMEOUT,
530+
531+
///It occurs when receiving timeout.
531532
RECEIVE_TIMEOUT,
532533
533534
/// When the server response, but with a incorrect status, such as 404, 503...
534535
RESPONSE,
535536
536537
/// When the request is cancelled, dio will throw a error with this type.
537538
CANCEL,
538-
539+
539540
/// Default error type, Some other Error. In this case, you can
540541
/// read the DioError.error if it is not null.
541542
DEFAULT

0 commit comments

Comments
 (0)