You’re free to subclass HTTPForbidden or just extend it. You can also subclass Denied as you noted. The big question to me is whether you can control the generation of that object to use the subclass and off the top of my head I think it’s always done in user code right now if you’re using the new SecurityPolicy interface but I could be wrong! You just have to program the forbidden view a little defensively or make a separate one for your subclass so that you can still handle exceptions generated from code you may not control.
- Michael
> On Aug 29, 2022, at 13:53, Sean Hammond <
pylons-...@snhmnd.fastmail.com> wrote:
>
> If a view raises an exception, say a custom ValidationError class, then that ValidationError object is set as request.exception when the exception view is called (if you have registered a matching custom exception view).
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
pylons-discus...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/bcf4aa9c-205d-4dc1-a684-20fa1f59a889%40www.fastmail.com.