{"size": 746, "ext": "js", "max_stars_repo_path": "server/helpers/errorHandler.js", "max_stars_repo_name": "NeoCognitiva/NC-Cloud-messaging", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/helpers/errorHandler.js", "max_issues_repo_name": "NeoCognitiva/NC-Cloud-messaging", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/helpers/errorHandler.js", "max_forks_repo_name": "NeoCognitiva/NC-Cloud-messaging", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.6923076923, "max_line_length": 122, "alphanum_fraction": 0.6407506702}
(function () {
	"use strict";

	module.exports = {
		handleError(err, expressResponse) {
			try {
				if (Object.prototype.hasOwnProperty.call(err, "status")) {
					return expressResponse.status(err.status || 500).send(err.message || err);
				} else {
					let parsedError = JSON.parse(err.message);
					return expressResponse.status(parsedError.status || 500).send(parsedError.message || err.message || "Unknown Error");
				}
			} catch (e) {
				return expressResponse.status(err.status || 500).send(err.message || err);
			}
		},
		handleCloudantError(err) {
			return new Error(JSON.stringify({
				"status": err.statusCode || err.status || 500,
				"message": err.reason || err.message || "Unknown Cloudant error"
			}));
		}
	};

}());
