Better error handling for JS errors during server rendering