koa-lite/lib
New Now Nohow 0a223f2bb7 Let errors provide their own status.
When calling `ctx.throw`, you're allowed to provide an error object and a
status code. The status code is later set as the `status` property of the error
object. If no status code is provided, it defaults to 500. However, this
happens even if the error object already had a `status` property.

This commit allows an error's pre-existing `status` property to be used in
conjunction with `ctx.throw`.

If the status code is below 500, the error message will be exposed to the user
in the HTTP response. It would be nice to have some Error subclasses that
always have the same status code, because then we could just write
`ctx.throw(new WhateverError())`, and define which 4xx error code we want in
the definition of `WhateverError` itself. If, for example, an
`AuthenticationError` is always meant to go along with a 401, then it would be
nice to just have that knowledge in the class definition.
2014-03-06 22:54:25 -05:00
..
application.js this.writable to check if the socket is writable 2014-02-15 02:06:08 -08:00
context.js Let errors provide their own status. 2014-03-06 22:54:25 -05:00
request.js Merge pull request #225 from dead-horse/issue224-host-confused 2014-02-26 10:54:40 -08:00
response.js Revert "add response.charset accessor and ctx.charset alias" 2014-03-06 18:05:01 -08:00
status.js Initial commit 2013-08-17 00:15:57 -07:00