Fix type coercion problem in client

Some browsers pass an object as the first argument to window.onerror
instead of a string. In this case we stringify the object.