-
Notifications
You must be signed in to change notification settings - Fork 1
HttpError
blackshadev edited this page Jan 10, 2015
·
3 revisions
HttpError describes a Error occurred in the system. Commonly used for HttpContext.error(err), where a instance of HttpError can be given as an argument.
var HttpError = require("roadie").HttpError; // Require to obtain the class
var err = new HttpError(500, "Something somewhere went terribly wrong");
this.ctx.error(err); // sends an error to the user.| Name | Description |
|---|---|
| extra | Extra text to describe the error |
| code | Http status code associated with the error, default 500 |
| text | Text belonging to the Http status code. Automaticly filled when empty |
| Name | Description |
|---|---|
| create(err, errtxt, extra) | Constructor of HttpError. Can be called with an NodeJs error object as first argument, a string as first argument. A number and a String or a number, string and a string. |
| httpStatus() | Returns a plain object containing all information of the error. Used to pass to the user |
| send(ctx) | Sends the error to the user with given HttpContext |