added a new RequestTypeError class that connectionClasses can throw to prevent a request from being retried and respond directly to the user.
This commit is contained in:
@ -69,6 +69,14 @@ errors.Serialization = function Serialization(msg) {
|
||||
_.inherits(errors.Serialization, ErrorAbstract);
|
||||
|
||||
|
||||
/**
|
||||
* Thrown when a browser compatability issue is detected (cough, IE, cough)
|
||||
*/
|
||||
errors.RequestTypeError = function RequestTypeError(feature) {
|
||||
ErrorAbstract.call(this, 'Cross-domain AJAX requests ' + feature + ' are not supported', errors.RequestTypeError);
|
||||
};
|
||||
_.inherits(errors.RequestTypeError, ErrorAbstract);
|
||||
|
||||
var statusCodes = {
|
||||
|
||||
/**
|
||||
|
||||
@ -180,6 +180,12 @@ Transport.prototype.request = function (params, cb) {
|
||||
|
||||
requestAborter = void 0;
|
||||
|
||||
if (err instanceof errors.RequestTypeError) {
|
||||
self.log.error('Connection refused to execute the request', err);
|
||||
respond(err, body, status, headers);
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
connection.setStatus('dead');
|
||||
if (remainingRetries) {
|
||||
|
||||
Reference in New Issue
Block a user