Add uncaught error handler

When the message continas the word token, send 401.

This is not ideal way to do this.