Added "new Error()" to throw statements so that message and stack are

Here's the pull request with enhanced error reporting :)