File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 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) {
342342 if ( result . success ) {
343343 return result . success ;
344344 }
345- const error = new Error (
345+ const error = new AVError (
346+ result . error . code ,
346347 result . error . error || 'Unknown batch error'
347348 ) ;
348- error . code = result . error . code ;
349349 throw error ;
350350 } ) ;
351351 }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const _ = require('underscore');
22const md5 = require ( 'md5' ) ;
33const { extend } = require ( 'underscore' ) ;
44const AV = require ( './av' ) ;
5+ const AVError = require ( './error' ) ;
56const { getSessionToken } = require ( './utils' ) ;
67const ajax = require ( './utils/ajax' ) ;
78
@@ -149,7 +150,7 @@ const request = ({
149150 }
150151 // Transform the error into an instance of AVError by trying to parse
151152 // the error string as JSON.
152- const err = new Error ( errorJSON . error ) ;
153+ const err = new AVError ( errorJSON . code , errorJSON . error ) ;
153154 delete errorJSON . error ;
154155 throw _ . extend ( err , errorJSON ) ;
155156 } )
You can’t perform that action at this time.
0 commit comments