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
Use gr.Error
for errors in gr.Audio
#6335
Comments
Thanks @hysts! I agree -- let's change these In terms of raising all errors to the frontend, we wouldn't want to do that by default because it might expose sensitive bits of the code for the gradio app to users, but if you are certain you want to do that, you can set |
Oh, I wasn't aware of the |
gr.Error
gr.Error
for errors in gr.Audio
This should be fixed in 4.2.0! |
@abidlabs @hannahblair gradio/gradio/components/audio.py Lines 118 to 136 in 1751f14
|
Hey @hysts, these are developer-facing errors (e.g. something is wrong with the code itself) so they should just raise a The user-facing OK to close this issue? |
@abidlabs Ah, so sorry. Yeah, I know. Somehow I linked completely different piece of code. 😇 gradio/gradio/components/audio.py Lines 183 to 190 in 1751f14
|
Oh haha that's weird I thought we fixed it. Should be an easy fix anyways! |
Would it be possible to catch
Exception
and re-raise it asgr.Error
?I was checking the recently added
min_length
andmax_length
ofgr.Audio
with code like this:and realized that it raises
ValueError
in.preprocess()
when one feeds an audio that is too short/long.gradio/gradio/components/audio.py
Lines 181 to 188 in f1409f9
But the problem is that the error is only shown in your terminal. In the case of HF Spaces, users except for the owner of the Space cannot see the log, and it makes it hard for them to understand why they get errors.
This reminds me that I wished
ValueError
,RuntimeError
etc. would be shown asgr.Error
many times in the past. I've mentionedgr.Audio
as an example above, but more generally, I think it would be nice if all errors were caught and re-raised asgr.Error
.The text was updated successfully, but these errors were encountered: