Page MenuHomeSealhub

error.js
No OneTemporary

error.js

var Response = require("./response.js");
var SealiousErrors = {};
SealiousErrors.Error = function(message){
this.message = message;
this.is_user_fault = false;
this.type = "error";
this.http_code = 500;
}
SealiousErrors.Error.prototype = new function(){
this.is_error = true;
this.toResponse = function(){
return new Response({}, true, this.type, this.message);
}
this.toString = function(){
}
}
SealiousErrors.ValidationError = function(message){
var err = new SealiousErrors.Error(message);
err.is_user_fault = true;
err.type="validation";
return err;
}
SealiousErrors.ValueExists = function(message){
var err = new SealiousErrors.Error(message);
err.is_user_fault = true;
err.type="valueExists";
this.http_code = 409;
return err;
}
SealiousErrors.InvalidCredentials = function(message){
var err = new SealiousErrors.Error(message);
err.is_user_fault = true;
err.type="validation";
err.http_code = 401;
return err;
}
SealiousErrors.NotFound = function(message){
var err = new SealiousErrors.Error(message);
err.is_user_fault = true;
err.type="not_found";
err.http_code = 404;
return err;
}
module.exports = SealiousErrors;

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 21, 00:21 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
837933
Default Alt Text
error.js (1 KB)

Event Timeline