Add better support for custom errors from server