Improve error handling so more errors are reported back to the client