File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ throw err;
118
118
ctx .throw (401 , ' access_denied' , { user: user });
119
119
```
120
120
121
- Koa uses [ http-errors] ( https://github.com/jshttp/http-errors ) to create errors.
121
+ Koa uses [ http-errors] ( https://github.com/jshttp/http-errors ) to create errors. ` status ` should only be passed as the first parameter.
122
122
123
123
### ctx.assert(value, [ status] , [ msg] , [ properties] )
124
124
Original file line number Diff line number Diff line change @@ -73,19 +73,20 @@ const proto = module.exports = {
73
73
assert : httpAssert ,
74
74
75
75
/**
76
- * Throw an error with `msg` and optional `status`
77
- * defaulting to 500 . Note that these are user-level
76
+ * Throw an error with `status` (default 500) and
77
+ * `msg` . Note that these are user-level
78
78
* errors, and the message may be exposed to the client.
79
79
*
80
80
* this.throw(403)
81
- * this.throw('name required', 400)
82
81
* this.throw(400, 'name required')
83
82
* this.throw('something exploded')
84
- * this.throw(new Error('invalid'), 400);
85
- * this.throw(400, new Error('invalid'));
83
+ * this.throw(new Error('invalid'))
84
+ * this.throw(400, new Error('invalid'))
86
85
*
87
86
* See: https://github.com/jshttp/http-errors
88
87
*
88
+ * Note: `stats` should only be passed as the first parameter.
89
+ *
89
90
* @param {String|Number|Error } err, msg or status
90
91
* @param {String|Number|Error } [err, msg or status]
91
92
* @param {Object } [props]
You can’t perform that action at this time.
0 commit comments