New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make exceptions in the Client more specific #8264
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/8d91c14aa50754fca4fceb1f8f9582923a3523f0/gradio-4.31.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@8d91c14aa50754fca4fceb1f8f9582923a3523f0#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
.changeset/blue-frogs-fetch.md
Outdated
@@ -0,0 +1,6 @@ | |||
--- | |||
"gradio": minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: feels like a patch to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely @abidlabs !
Thanks @freddyaboulton for the review! |
Previously, If an exception was raised in the upstream app due to an invalid value provided by the Python Client, then the error that is raised is not very informative:
My initial thought was to transmit the error from the server to the client to provide better error messages. However, we intentionally do not reveal exceptions to users of Gradio applications as they can reveal security vulnerabilities, unless
show_error=True
.So this PR only prints the upstream exception if
show_error=True
, otherwise prints a generic error explaining how to print more detailed errors. For other types of errors that the Client can generate, e.g. when an invalid parameter is provided, it changes the errors to beTypeError
instead ofValueError
-- that's consistent with the error type that is raised when you call a function in Python with the wrong parameters.Closes: #7889