Closed BenElgar closed 6 years ago
All errors (that I've tested), aside from 404s, are converted to 500s in development mode.
To reproduce use the following server file:
const carbon = require('carbon-io') const o = carbon.atom.o(module).main const __ = carbon.fibers.__(module).main __(function() { module.exports = o({ _type: carbon.carbond.Service, port: 8890, endpoints: { hello: o({ _type: carbon.carbond.Endpoint, get: function() { throw new this.service.errors.Unauthorized() }, }), }, }) })
and then curl the endpoint.
If run without setting any command parameters or environment variables this is the result:
$ curl -I http://localhost:8890/hello HTTP/1.1 401 Unauthorized Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Location Content-Type: application/json; charset=utf-8 Content-Length: 71 ETag: W/"47-362146d" Date: Wed, 27 Sep 2017 23:27:19 GMT Connection: keep-alive
When run with the --env development command line parameter this is the result:
--env development
$ curl -I http://localhost:8890/hello HTTP/1.1 500 Internal Server Error Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Location X-Content-Type-Options: nosniff Content-Type: text/html; charset=utf-8 Content-Length: 1305 Date: Wed, 27 Sep 2017 23:27:07 GMT Connection: keep-alive
🍥
All errors (that I've tested), aside from 404s, are converted to 500s in development mode.
To reproduce use the following server file:
and then curl the endpoint.
If run without setting any command parameters or environment variables this is the result:
When run with the
--env development
command line parameter this is the result: