Render an error page
function handleError(req, res, err) {
    switch (err.name) {
      case 'NotFoundError':
        render(req, res, 'error', err, {status: 404});
        break;
      default:
        render(req, res, 'error', err, {status: 500});
    }
  }