From 0610a841df0da98464e0960198edc5a66f95bca3 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Mon, 20 Jan 2014 18:44:07 -0800 Subject: [PATCH] change ctx.throw() to no longer .expose 5xx errors. Closes #197 --- lib/context.js | 2 +- test/context/throw.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/context.js b/lib/context.js index dac144f..386f99d 100644 --- a/lib/context.js +++ b/lib/context.js @@ -72,7 +72,7 @@ var proto = module.exports = { var err = msg instanceof Error ? msg : new Error(msg); err.status = status || 500; - err.expose = true; + err.expose = err.status < 500; throw err; }, diff --git a/test/context/throw.js b/test/context/throw.js index 184d5da..ee06976 100644 --- a/test/context/throw.js +++ b/test/context/throw.js @@ -10,6 +10,7 @@ describe('ctx.throw(msg)', function(){ ctx.throw('boom'); } catch (err) { assert(500 == err.status); + assert(false === err.expose); done(); } })