lib/web/api.js
function handleError(err, req, res) {
    switch (err.name) {
      case 'NotFoundError':
        res.send(err, 404);
        break;
      default:
        res.send(err, 500);
    }
  }
function handleError(err, req, res) {
    switch (err.name) {
      case 'NotFoundError':
        res.send(err, 404);
        break;
      default:
        res.send(err, 500);
    }
  }
Utility for handling errors