[bert] always throw Error instances

Throw Error instead of string objects so that crashes are
easier to diagnose when bert.js is used in mocha tests.