@aws-amplify/auth 4.3.7 → 4.3.8-unstable.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/aws-amplify-auth.js
CHANGED
|
@@ -5588,38 +5588,29 @@ var Client = /*#__PURE__*/function () {
|
|
|
5588
5588
|
// eslint-disable-next-line no-underscore-dangle
|
|
5589
5589
|
|
|
5590
5590
|
var code = (data.__type || data.code).split('#').pop();
|
|
5591
|
-
var error =
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
message: data.message || data.Message || null
|
|
5595
|
-
};
|
|
5591
|
+
var error = new Error(data.message || data.Message || null);
|
|
5592
|
+
error.name = code;
|
|
5593
|
+
error.code = code;
|
|
5596
5594
|
return callback(error);
|
|
5597
5595
|
})["catch"](function (err) {
|
|
5598
5596
|
// first check if we have a service error
|
|
5599
5597
|
if (response && response.headers && response.headers.get('x-amzn-errortype')) {
|
|
5600
5598
|
try {
|
|
5601
5599
|
var code = response.headers.get('x-amzn-errortype').split(':')[0];
|
|
5602
|
-
var error =
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
message: response.status ? response.status.toString() : null
|
|
5607
|
-
};
|
|
5600
|
+
var error = new Error(response.status ? response.status.toString() : null);
|
|
5601
|
+
error.code = code;
|
|
5602
|
+
error.name = code;
|
|
5603
|
+
error.statusCode = response.status;
|
|
5608
5604
|
return callback(error);
|
|
5609
5605
|
} catch (ex) {
|
|
5610
5606
|
return callback(err);
|
|
5611
5607
|
} // otherwise check if error is Network error
|
|
5612
5608
|
|
|
5613
5609
|
} else if (err instanceof Error && err.message === 'Network error') {
|
|
5614
|
-
|
|
5615
|
-
code: 'NetworkError',
|
|
5616
|
-
name: err.name,
|
|
5617
|
-
message: err.message
|
|
5618
|
-
};
|
|
5619
|
-
return callback(_error);
|
|
5620
|
-
} else {
|
|
5621
|
-
return callback(err);
|
|
5610
|
+
err.code = 'NetworkError';
|
|
5622
5611
|
}
|
|
5612
|
+
|
|
5613
|
+
return callback(err);
|
|
5623
5614
|
});
|
|
5624
5615
|
};
|
|
5625
5616
|
|