change console.log to throw error

if some error happen, i think throw an error is more proper than just printing something in console. ╮（╯◇╰）╭