change console.log to throw error

if some error happen, i think throw an error is more proper than just printing something in console. ╮（╯◇╰）╭
Merge pull request #10 from jabez128/master

change console.log to throw error