From efd7693dcd9622bae768658066f55cff17bc2605 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 24 Aug 2018 23:53:29 -0600 Subject: [PATCH] v2.4.6 respond with 500 on unhandled exception from user's HTTP handler --- index.js | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 74e2e15..fc5b249 100644 --- a/index.js +++ b/index.js @@ -65,6 +65,13 @@ module.exports.create = function (opts) { } catch(e) { console.error("[error] [greenlock.app] Your HTTP handler had an uncaught error:"); console.error(e); + try { + res.statusCode = 500; + res.end("Internal Server Error: [Greenlock] HTTP exception logged for user-provided handler."); + } catch(e) { + // ignore + // (headers may have already been sent, etc) + } } }) ); diff --git a/package.json b/package.json index 1b2b643..6ab19ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greenlock-express", - "version": "2.4.5", + "version": "2.4.6", "description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.", "main": "index.js", "homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js",