2016-12-22 21:22:47 -05:00
|
|
|
var ErrorConstants = require('../constants/ErrorConstants');
|
|
|
|
|
2016-12-28 09:25:20 -05:00
|
|
|
var models = require('../models');
|
2016-12-22 21:22:47 -05:00
|
|
|
var Error = models.Error;
|
|
|
|
|
|
|
|
function serverError(error) {
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.ERROR_SERVER,
|
|
|
|
error: error
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function ajaxError(error) {
|
|
|
|
var e = new Error();
|
|
|
|
e.ErrorId = 5;
|
|
|
|
e.ErrorString = "Request Failed: " + status + error;
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.ERROR_AJAX,
|
|
|
|
error: e
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearError() {
|
|
|
|
return {
|
|
|
|
type: ErrorConstants.CLEAR_ERROR,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
serverError: serverError,
|
|
|
|
ajaxError: ajaxError,
|
|
|
|
clearError: clearError
|
|
|
|
};
|