mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
don't reauthenticate on HTTP 400 errors
since these are likely unrelated to authentication issues, but rather have to do with generic API errors or outages
This commit is contained in:
@@ -524,8 +524,8 @@ function updateRtree(item, replace) {
|
||||
function wrapcb(thisArg, callback, cid) {
|
||||
return function(err, result) {
|
||||
if (err) {
|
||||
// 400 Bad Request, 401 Unauthorized, 403 Forbidden..
|
||||
if (err.status === 400 || err.status === 401 || err.status === 403) {
|
||||
// 401 Unauthorized, 403 Forbidden
|
||||
if (err.status === 401 || err.status === 403) {
|
||||
thisArg.logout();
|
||||
}
|
||||
return callback.call(thisArg, err);
|
||||
@@ -642,23 +642,21 @@ export default {
|
||||
|
||||
var isAuthenticated = that.authenticated();
|
||||
|
||||
// 400 Bad Request, 401 Unauthorized, 403 Forbidden
|
||||
// Logout and retry the request..
|
||||
// 401 Unauthorized, 403 Forbidden
|
||||
// Logout and retry the request.
|
||||
if (isAuthenticated && err && err.status &&
|
||||
(err.status === 400 || err.status === 401 || err.status === 403)) {
|
||||
(err.status === 401 || err.status === 403)) {
|
||||
that.logout();
|
||||
that.loadFromAPI(path, callback, options);
|
||||
|
||||
// else, no retry..
|
||||
// else, no retry.
|
||||
} else {
|
||||
// 509 Bandwidth Limit Exceeded, 429 Too Many Requests
|
||||
// Set the rateLimitError flag and trigger a warning..
|
||||
// Set the rateLimitError flag and trigger a warning.
|
||||
if (!isAuthenticated && !_rateLimitError && err && err.status &&
|
||||
(err.status === 509 || err.status === 429)) {
|
||||
_rateLimitError = err;
|
||||
dispatch.call('change');
|
||||
that.reloadApiStatus();
|
||||
|
||||
} else if ((err && _cachedApiStatus === 'online') ||
|
||||
(!err && _cachedApiStatus !== 'online')) {
|
||||
// If the response's error state doesn't match the status,
|
||||
|
||||
Reference in New Issue
Block a user