{"size": 413, "ext": "js", "max_stars_repo_path": "api/src/utils/middlewares/errors.js", "max_stars_repo_name": "stoleS/wishlist-tracker", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api/src/utils/middlewares/errors.js", "max_issues_repo_name": "stoleS/wishlist-tracker", "max_issues_repo_issues_event_min_datetime": "2022-01-22T11:14:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-22T11:14:26.000Z", "max_forks_repo_path": "api/src/utils/middlewares/errors.js", "max_forks_repo_name": "stoleS/wishlist-tracker", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 19.6666666667, "max_line_length": 54, "alphanum_fraction": 0.617433414}
const notFoundCatcher = (req, res, next) => {
  const err = new Error('Not Found')
  err.status = 404
  next(err)
}

const errorHandler = (err, req, res, next) => {
  const error = process.env.STAGE === 'dev' ? err : {}
  const status = err.status || 500

  res.status(status).json({
    error: {
      message: error.message
    }
  })

  console.error(err)
}

module.exports = { notFoundCatcher, errorHandler }
