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:
Spencer Alger
2014-05-08 17:12:20 -07:00
parent 73203256d2
commit 1a383aced5
2 changed files with 14 additions and 0 deletions

View File

@ -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 = {
/**

View File

@ -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) {