mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-27 07:52:28 -05:00
59 lines
960 B
JavaScript
59 lines
960 B
JavaScript
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;
|
|
e.ErrorString = "Request Failed: " + error;
|
|
|
|
return {
|
|
type: ErrorConstants.ERROR_AJAX,
|
|
error: e
|
|
};
|
|
}
|
|
|
|
function clientError(error) {
|
|
var e = new Error();
|
|
e.ErrorId = 999;
|
|
e.ErrorString = "Client Error: " + error;
|
|
|
|
return {
|
|
type: ErrorConstants.ERROR_CLIENT,
|
|
error: e
|
|
};
|
|
}
|
|
|
|
function userError(error) {
|
|
var e = new Error();
|
|
e.ErrorId = 999;
|
|
e.ErrorString = error;
|
|
|
|
return {
|
|
type: ErrorConstants.ERROR_USER,
|
|
error: e
|
|
};
|
|
}
|
|
|
|
function clearError() {
|
|
return {
|
|
type: ErrorConstants.CLEAR_ERROR,
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
serverError: serverError,
|
|
ajaxError: ajaxError,
|
|
clientError: clientError,
|
|
userError: userError,
|
|
clearError: clearError
|
|
};
|