rc@73
|
1 # errorhandler
|
rc@73
|
2
|
rc@73
|
3 [](http://badge.fury.io/js/errorhandler)
|
rc@73
|
4 [](https://travis-ci.org/expressjs/errorhandler)
|
rc@73
|
5 [](https://coveralls.io/r/expressjs/errorhandler)
|
rc@73
|
6
|
rc@73
|
7 Previously `connect.errorHandler()`.
|
rc@73
|
8
|
rc@73
|
9 ## Install
|
rc@73
|
10
|
rc@73
|
11 ```sh
|
rc@73
|
12 $ npm install errorhandler
|
rc@73
|
13 ```
|
rc@73
|
14
|
rc@73
|
15 ## API
|
rc@73
|
16
|
rc@73
|
17 ### errorhandler()
|
rc@73
|
18
|
rc@73
|
19 Create new middleware to handle errors and respond with content negotiation.
|
rc@73
|
20 This middleware is only intended to be used in a development environment, as
|
rc@73
|
21 the full error stack traces will be send back to the client when an error
|
rc@73
|
22 occurs.
|
rc@73
|
23
|
rc@73
|
24 ## Example
|
rc@73
|
25
|
rc@73
|
26 ```js
|
rc@73
|
27 var connect = require('connect')
|
rc@73
|
28 var errorhandler = require('errorhandler')
|
rc@73
|
29
|
rc@73
|
30 var app = connect()
|
rc@73
|
31
|
rc@73
|
32 if (process.env.NODE_ENV === 'development') {
|
rc@73
|
33 app.use(errorhandler())
|
rc@73
|
34 }
|
rc@73
|
35 ```
|
rc@73
|
36
|
rc@73
|
37 ## License
|
rc@73
|
38
|
rc@73
|
39 The MIT License (MIT)
|
rc@73
|
40
|
rc@73
|
41 Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
rc@73
|
42
|
rc@73
|
43 Permission is hereby granted, free of charge, to any person obtaining a copy
|
rc@73
|
44 of this software and associated documentation files (the "Software"), to deal
|
rc@73
|
45 in the Software without restriction, including without limitation the rights
|
rc@73
|
46 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
rc@73
|
47 copies of the Software, and to permit persons to whom the Software is
|
rc@73
|
48 furnished to do so, subject to the following conditions:
|
rc@73
|
49
|
rc@73
|
50 The above copyright notice and this permission notice shall be included in
|
rc@73
|
51 all copies or substantial portions of the Software.
|
rc@73
|
52
|
rc@73
|
53 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
rc@73
|
54 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
rc@73
|
55 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
rc@73
|
56 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
rc@73
|
57 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
rc@73
|
58 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
rc@73
|
59 THE SOFTWARE.
|