having a bit of a snag in my code when trying to require() modules that don't exists.
The code loops through a directory and does a var appname = require('path')
on each folder. This works for appropriately configured modules but throws: Error: Cannot find module
when the loop hits a non-module.
I want to be able to handle this error gracefully, instead of letting it stop my entire process. So in short, how does one catch an error thrown by require()
?
thanks!