Attach an error handler to phantom.onError.