ValueError: Authorisation required
at anvil_extras/authorisation.py:52
I have tested it withouth the @authenticated_callable and with a permission that does exist and it works. I am just failing to handle the ValueError exception. Should I handle it on the server side? if so, where would the try/except go?
The issue was that the error was being raised in the decorator, which is in untouchable code. This did not allow me to catch the exception being raised by an try/except clause.
I resolved this by creating a wrapper function to call the method which has the authorisation_required exception and then returning that exception to the server side:
That was what I originally tried, but what happened was the error being raised on the server side and preventing the try/except clause to complete on the client side
Odd, I would have expected that to work. You should post about it in the Github link Patricia posted, to let the Anvil Extras folks can see if it’s something specific to them.
After posting on the github discussion (thank you @patricia for the suggestion), it looks like I was using the wrong exception. I needed to use except Exception vs except ValueError.
I was trying to be more specific with my exception case as ValueError is the exception raised by anvil extras, but in this situation I’ll take it!