2016-10-03 19:49:15 -04:00
|
|
|
var ErrorConstants = require('../constants/ErrorConstants');
|
|
|
|
|
|
|
|
var models = require('../models.js');
|
|
|
|
var Error = models.Error;
|
|
|
|
|
|
|
|
function serverError(error) {
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.ERROR_SERVER,
|
|
|
|
error: error
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function ajaxError(error) {
|
|
|
|
var e = new Error();
|
|
|
|
e.ErrorId = 5;
|
2017-01-09 21:22:13 -05:00
|
|
|
e.ErrorString = "Request Failed: " + error;
|
2016-10-03 19:49:15 -04:00
|
|
|
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.ERROR_AJAX,
|
|
|
|
error: e
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-02-17 10:01:31 -05:00
|
|
|
function clientError(error) {
|
|
|
|
var e = new Error();
|
|
|
|
e.ErrorId = 999;
|
|
|
|
e.ErrorString = "Client Error: " + error;
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.ERROR_CLIENT,
|
|
|
|
error: e
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-10-05 13:36:47 -04:00
|
|
|
function clearError() {
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.CLEAR_ERROR,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-10-03 19:49:15 -04:00
|
|
|
module.exports = {
|
|
|
|
serverError: serverError,
|
2016-10-05 13:36:47 -04:00
|
|
|
ajaxError: ajaxError,
|
2017-02-17 10:01:31 -05:00
|
|
|
clientError: clientError,
|
2016-10-05 13:36:47 -04:00
|
|
|
clearError: clearError
|
2016-10-03 19:49:15 -04:00
|
|
|
};
|