@@ -242,27 +242,27 @@ function isValidPostType (type) {
242
242
return type >= exports . MSGTYPE_INSTANT && type <= exports . MSGTYPE_PERSIST
243
243
}
244
244
245
- function codeToError ( code ) {
245
+ function codeToError ( code ) {
246
246
var err
247
247
switch ( code ) {
248
- case exports . ERROR_INVALID_PARAM :
249
- err = new Error ( 'invalid params' )
250
- break
251
- case exports . ERROR_NOT_CONNECTED :
252
- err = new Error ( 'flora service not connected' )
253
- break
254
- case exports . ERROR_TIMEOUT :
255
- err = new Error ( 'flora call response timeout' )
256
- break
257
- case exports . ERROR_TARGET_NOT_EXISTS :
258
- err = new Error ( 'flora call target not exists' )
259
- break
260
- case exports . ERROR_DUPLICATED_ID :
261
- err = new Error ( 'flora client id duplicated' )
262
- break
263
- default :
264
- err = new Error ( 'unknown error code ' + code )
265
- break
248
+ case exports . ERROR_INVALID_PARAM :
249
+ err = new Error ( 'invalid params' )
250
+ break
251
+ case exports . ERROR_NOT_CONNECTED :
252
+ err = new Error ( 'flora service not connected' )
253
+ break
254
+ case exports . ERROR_TIMEOUT :
255
+ err = new Error ( 'flora call response timeout' )
256
+ break
257
+ case exports . ERROR_TARGET_NOT_EXISTS :
258
+ err = new Error ( 'flora call target not exists' )
259
+ break
260
+ case exports . ERROR_DUPLICATED_ID :
261
+ err = new Error ( 'flora client id duplicated' )
262
+ break
263
+ default :
264
+ err = new Error ( 'unknown error code ' + code )
265
+ break
266
266
}
267
267
err . code = code
268
268
return err
@@ -283,8 +283,7 @@ Agent.prototype.post = function (name, msg, type) {
283
283
throw codeToError ( exports . ERROR_INVALID_PARAM )
284
284
}
285
285
var r = this . nativePost ( name , msg , type , isCaps ( msg ) )
286
- if ( r !== 0 )
287
- throw codeToError ( r )
286
+ if ( r !== 0 ) { throw codeToError ( r ) }
288
287
return r
289
288
}
290
289
0 commit comments