diff --git a/lib/router/router.js b/lib/router/router.js index 9c415ec..5a4e2db 100644 --- a/lib/router/router.js +++ b/lib/router/router.js @@ -86,7 +86,10 @@ Router.prototype = { // build outputter var outputter = this.buildOutputter(req.headers.accept, function(err) { - //TODO error code, terminate resp + logger.error(err); + resp.writeHead(500, 'outputter failure'); + resp.write(err.message); + resp.end(); }); logger.debug('outputter: ' + outputter); @@ -94,10 +97,12 @@ Router.prototype = { var url = require('url').parse(req.url, true); // TODO sanitize url.pathname this.buildEndpoint(url.pathname, function(err, endpoint) { - //TODO err if (err) { logger.error(err); - // TODO write error in response + resp.writeHead(404, 'no endpoint for ' + url.pathname); + resp.write(err.message); + resp.end(); + return; } endpoint.buildAction(req.method, url, function(err, action) { //TODO err