mirror of
https://github.com/azures04/crafatar.git
synced 2026-05-06 19:10:38 +02:00
catch HTTP 500/503 and empty response, fixes #141
This commit is contained in:
@@ -91,6 +91,8 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
case 204:
|
case 204:
|
||||||
|
case 500:
|
||||||
|
case 503:
|
||||||
// we don't want to cache this
|
// we don't want to cache this
|
||||||
body = null;
|
body = null;
|
||||||
break;
|
break;
|
||||||
@@ -107,6 +109,11 @@ exp.get_from_options = function(rid, url, options, callback) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (body && !body.length) {
|
||||||
|
// empty response
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
callback(body, response, error);
|
callback(body, response, error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user