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(); } })