File tree 2 files changed +4
-3
lines changed 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -342,10 +342,10 @@ module.exports = function(AV) {
342
342
if ( result . success ) {
343
343
return result . success ;
344
344
}
345
- const error = new Error (
345
+ const error = new AVError (
346
+ result . error . code ,
346
347
result . error . error || 'Unknown batch error'
347
348
) ;
348
- error . code = result . error . code ;
349
349
throw error ;
350
350
} ) ;
351
351
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const _ = require('underscore');
2
2
const md5 = require ( 'md5' ) ;
3
3
const { extend } = require ( 'underscore' ) ;
4
4
const AV = require ( './av' ) ;
5
+ const AVError = require ( './error' ) ;
5
6
const { getSessionToken } = require ( './utils' ) ;
6
7
const ajax = require ( './utils/ajax' ) ;
7
8
@@ -149,7 +150,7 @@ const request = ({
149
150
}
150
151
// Transform the error into an instance of AVError by trying to parse
151
152
// the error string as JSON.
152
- const err = new Error ( errorJSON . error ) ;
153
+ const err = new AVError ( errorJSON . code , errorJSON . error ) ;
153
154
delete errorJSON . error ;
154
155
throw _ . extend ( err , errorJSON ) ;
155
156
} )
You can’t perform that action at this time.
0 commit comments