{"size": 438, "ext": "js", "max_stars_repo_path": "src/bootstrap/error.js", "max_stars_repo_name": "BruceHem/kodejs", "max_stars_repo_stars_event_min_datetime": "2017-01-31T01:40:21.000Z", "max_stars_repo_stars_event_max_datetime": "2017-07-17T07:50:35.000Z", "max_issues_repo_path": "src/bootstrap/error.js", "max_issues_repo_name": "chanlito/kodejs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/bootstrap/error.js", "max_forks_repo_name": "chanlito/kodejs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 6, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.3333333333, "max_line_length": 82, "alphanum_fraction": 0.5730593607}
export default () => async (ctx, next) => {
  try {
    await next()
  } catch (error) {
    console.log(error)
    const { message = 'Internal Server Error', stack, status, statusCode } = error
    const code = status || statusCode || 500
    ctx.set('Message', message)
    ctx.status = code
    ctx.body = {
      code,
      message,
      ...error,
      stack: process.env.NODE_ENV === 'development' ? stack : undefined
    }
  }
}
