Skip to content

enekid/kubide-express-errorhandler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

errorhandler-express

An express middleware module to generate HTTP responses on error.

TODO: Pending add more checks, test and documentation

Installation

The best way to install it is using npm

npm install errorhandler-express --save

Loading

var apiSetter = require('errorhandler-express');

Initialization and Usage

Basic usage (you can see how works better with test:

    app = express();
    var options = {
        errors : {
            app : {
                user : {
                    myOwnError : {
                        status : 401,
                        msg : "you can't see me"
                    }
                }
            }
        }
    };
    var kError = require('../index')(options);

    app.get('/error1', function (req, res, next) {
        next(kError.createError("http.badRequest"));
    });

    app.get('/error2', function (req, res, next) {
        next(kError.createError("app.user.myOwnError", {detail: new Date()}));
    });


    app.use(kError.errorHandling)

Support

This plugin is proudly supported by Kubide [email protected]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%