{"size": 813, "ext": "js", "max_stars_repo_path": "js-es.async-promise/async-await.2/await.2.async-await-style.js", "max_stars_repo_name": "loggar/js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "js-es.async-promise/async-await.2/await.2.async-await-style.js", "max_issues_repo_name": "loggar/js", "max_issues_repo_issues_event_min_datetime": "2020-03-03T03:12:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-27T00:30:10.000Z", "max_forks_repo_path": "js-es.async-promise/async-await.2/await.2.async-await-style.js", "max_forks_repo_name": "loggar/js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 12, "max_forks_count": null, "avg_line_length": 26.2258064516, "max_line_length": 125, "alphanum_fraction": 0.7109471095}
async function handler(req, res) {
	let response
	try {
		response = await request('https://user-handler-service')
	} catch (err) {
		logger.error('Http error', err)
		return res.status(500).send()
	}

	let document
	try {
		document = await Mongo.findOne({ user: response.body.user })
	} catch (err) {
		logger.error('Mongo error', err)
		return res.status(500).send()
	}

	executeLogic(document, req, res)
}

/*
In older versions of V8, unhandled promise rejections were silently dropped.
Now at least you get a warning from Node, so you don’t necessarily need to bother with creating a listener.
However, it is recommended to crash your app in this case as when you don’t handle an error, your app is in an unknown state:
*/

process.on('unhandledRejection', (err) => {
	console.error(err)
	process.exit(1)
})
