Skip to content

Instantly share code, notes, and snippets.

@stelcheck

stelcheck/app.js

Created Jun 2, 2017
Embed
What would you like to do?
require cache behaviour on throw
try {
require('./bad-require')
} catch (error) {
console.error('first error:', error.message)
}
try {
require('./bad-require')
} catch (error) {
console.error('second error:', error.message)
}
require('./registry').register(__filename)
throw new Error('nein nein nein nein nein') // We provide five neins of availability
const registry = {}
exports.register = function (name) {
if (registry[name]) {
throw new Error('already registered!')
}
registry[name] = true
}
@stelcheck

This comment has been minimized.

Copy link
Owner Author

@stelcheck stelcheck commented Jun 2, 2017

To test: run node app.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment