diff options
author | isaacs <i@izs.me> | 2013-03-13 15:36:52 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-03-13 15:51:32 -0700 |
commit | 5e140b33e58bd0ac6779fb0cb635dd51e1a27289 (patch) | |
tree | 85aa5e7a1fc1a2ce033fb020584f4f8ef1b7e3d5 /lib/fs.js | |
parent | 59178286224917034a340a8fb1a93c252ae3d742 (diff) | |
download | nodejs-5e140b33e58bd0ac6779fb0cb635dd51e1a27289.tar.gz nodejs-5e140b33e58bd0ac6779fb0cb635dd51e1a27289.tar.bz2 nodejs-5e140b33e58bd0ac6779fb0cb635dd51e1a27289.zip |
Revert "fs: Missing cb errors are deprecated, not a throw"
This reverts commits 6bd8b7e5405e1cdc9f56214f5f6b741806c32e5f
and fa05e8a2706e20a191942fe2b2273481605a1f14.
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 34 |
1 files changed, 10 insertions, 24 deletions
@@ -59,36 +59,22 @@ var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); function rethrow() { // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and // is fairly slow to generate. - var callback; if (DEBUG) { var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; - - return callback; - - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } + return function(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + throw err; + } + }; } - function missingCallback(err) { + return function(err) { if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs } - } + }; } function maybeCallback(cb) { |