@@ -10398,37 +10398,37 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1039810398 } ;
1039910399
1040010400 // handle AV._request Error
10401- var handleError = function handleError ( res ) {
10402- var promise = new AVPromise ( ) ;
10403- /**
10404- When API request need to redirect to the right location,
10405- can't use browser redirect by http status 307, as the reason of CORS,
10406- so API server response http status 410 and the param "location" for this case.
10407- */
10408- if ( res . statusCode === 410 ) {
10409- cacheServerURL ( res . response . api_server , res . response . ttl ) . then ( function ( ) {
10410- promise . resolve ( res . response . location ) ;
10411- } ) . catch ( function ( error ) {
10412- promise . reject ( error ) ;
10413- } ) ;
10414- } else {
10415- var errorJSON = { code : - 1 , error : res . responseText } ;
10416- if ( res . response && res . response . code ) {
10417- errorJSON = res . response ;
10418- } else if ( res . responseText ) {
10419- try {
10420- errorJSON = JSON . parse ( res . responseText ) ;
10421- } catch ( e ) {
10422- // If we fail to parse the error text, that's okay.
10401+ var handleError = function handleError ( error ) {
10402+ return new AVPromise ( function ( resolve , reject ) {
10403+ /**
10404+ When API request need to redirect to the right location,
10405+ can't use browser redirect by http status 307, as the reason of CORS,
10406+ so API server response http status 410 and the param "location" for this case.
10407+ */
10408+ if ( error . statusCode === 410 ) {
10409+ cacheServerURL ( error . response . api_server , error . response . ttl ) . then ( function ( ) {
10410+ resolve ( error . response . location ) ;
10411+ } ) . catch ( reject ) ;
10412+ } else {
10413+ var errorJSON = {
10414+ code : error . code || - 1 ,
10415+ error : error . message || error . responseText
10416+ } ;
10417+ if ( error . response && error . response . code ) {
10418+ errorJSON = error . response ;
10419+ } else if ( error . responseText ) {
10420+ try {
10421+ errorJSON = JSON . parse ( error . responseText ) ;
10422+ } catch ( e ) {
10423+ // If we fail to parse the error text, that's okay.
10424+ }
1042310425 }
10424- }
1042510426
10426- // Transform the error into an instance of AVError by trying to parse
10427- // the error string as JSON.
10428- var error = new AVError ( errorJSON . code , errorJSON . error ) ;
10429- promise . reject ( error ) ;
10430- }
10431- return promise ;
10427+ // Transform the error into an instance of AVError by trying to parse
10428+ // the error string as JSON.
10429+ reject ( new AVError ( errorJSON . code , errorJSON . error ) ) ;
10430+ }
10431+ } ) ;
1043210432 } ;
1043310433
1043410434 var setServerUrl = function setServerUrl ( serverURL ) {
@@ -12775,7 +12775,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1277512775 */
1277612776 AV . _getAVPath = function ( path ) {
1277712777 if ( ! AV . applicationId ) {
12778- throw " You need to call AV.initialize before using AV." ;
12778+ throw new Error ( ' You need to call AV.init() before using AV.' ) ;
1277912779 }
1278012780 if ( ! path ) {
1278112781 path = "" ;
@@ -13106,6 +13106,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1310613106 * Each engineer has a duty to keep the code elegant
1310713107 **/
1310813108
13109- module . exports = 'js1.5.2 ' ;
13109+ module . exports = 'js1.5.3 ' ;
1311013110 } , { } ] } , { } , [ 27 ] ) ( 27 ) ;
1311113111} ) ;
0 commit comments