@@ -116,15 +116,15 @@ impl OnlineConfigService {
116
116
Ok ( r) => r,
117
117
Err ( err) => {
118
118
error ! ( "server-loader task failed to make hyper::Request, error: {}" , err) ;
119
- return Err ( io:: Error :: new ( io :: ErrorKind :: Other , err) ) ;
119
+ return Err ( io:: Error :: other ( err) ) ;
120
120
}
121
121
} ;
122
122
123
123
let mut rsp = match self . http_client . send_request ( self . context . clone ( ) , req, None ) . await {
124
124
Ok ( r) => r,
125
125
Err ( err) => {
126
126
error ! ( "server-loader task failed to get {}, error: {}" , self . config_url, err) ;
127
- return Err ( io:: Error :: new ( io :: ErrorKind :: Other , err) ) ;
127
+ return Err ( io:: Error :: other ( err) ) ;
128
128
}
129
129
} ;
130
130
@@ -139,8 +139,7 @@ impl OnlineConfigService {
139
139
self . config_url,
140
140
rsp. status( )
141
141
) ;
142
- return Err ( io:: Error :: new (
143
- io:: ErrorKind :: Other ,
142
+ return Err ( io:: Error :: other (
144
143
format ! ( "status: {}" , rsp. status( ) ) ,
145
144
) ) ;
146
145
}
@@ -182,15 +181,15 @@ impl OnlineConfigService {
182
181
Ok ( ce) => ce,
183
182
Err ( ..) => {
184
183
error ! ( "unrecognized Content-Encoding: {:?}" , ce) ;
185
- return Err ( io:: Error :: new ( io :: ErrorKind :: Other , "unrecognized Content-Encoding" ) ) ;
184
+ return Err ( io:: Error :: other ( "unrecognized Content-Encoding" ) ) ;
186
185
}
187
186
} ,
188
187
} ;
189
188
190
189
let body = read_body ( content_encoding, & mut rsp) . await ?;
191
190
let parsed_body = match String :: from_utf8 ( body) {
192
191
Ok ( b) => b,
193
- Err ( ..) => return Err ( io:: Error :: new ( io :: ErrorKind :: Other , "body contains non-utf8 bytes" ) ) ,
192
+ Err ( ..) => return Err ( io:: Error :: other ( "body contains non-utf8 bytes" ) ) ,
194
193
} ;
195
194
196
195
let online_config = match Config :: load_from_str ( & parsed_body, ConfigType :: OnlineConfig ) {
@@ -200,7 +199,7 @@ impl OnlineConfigService {
200
199
"server-loader task failed to load from url: {}, error: {}" ,
201
200
self . config_url, err
202
201
) ;
203
- return Err ( io:: Error :: new ( io :: ErrorKind :: Other , err) ) ;
202
+ return Err ( io:: Error :: other ( err) ) ;
204
203
}
205
204
} ;
206
205
@@ -209,7 +208,7 @@ impl OnlineConfigService {
209
208
"server-loader task failed to load from url: {}, error: {}" ,
210
209
self . config_url, err
211
210
) ;
212
- return Err ( io:: Error :: new ( io :: ErrorKind :: Other , err) ) ;
211
+ return Err ( io:: Error :: other ( err) ) ;
213
212
}
214
213
215
214
let after_read_time = Instant :: now ( ) ;
@@ -223,8 +222,7 @@ impl OnlineConfigService {
223
222
"server-loader task found not allowed plugin: {}, url: {}" ,
224
223
plugin. plugin, self . config_url
225
224
) ;
226
- return Err ( io:: Error :: new (
227
- io:: ErrorKind :: Other ,
225
+ return Err ( io:: Error :: other (
228
226
format ! ( "not allowed plugin: {}" , plugin. plugin) ,
229
227
) ) ;
230
228
}
0 commit comments