MasoniteFramework / exceptionite

A Python Exception Library. Designed to make handling and displaying exceptions a cinch.
MIT License
124 stars 4 forks source link

Ensure that serialization of data cannot raise an error when handling an exception #23

Open girardinsamuel opened 2 years ago

girardinsamuel commented 2 years ago

It should also be ensured on Masonite blocks or tabs:

https://github.com/MasoniteFramework/masonite/blob/b166e959baa1f0a641259cec03472cfd38c57f0d/src/masonite/providers/ExceptionProvider.py#L46

girardinsamuel commented 2 years ago

All blocks or tab have a serialize() method, inside this we should not get a serialization error.

If we have one we could still add a try/except in the web renderer render() method to catch Serialization error and display something to the user ?

girardinsamuel commented 2 years ago

To reproduce the error we can do a file upload from a POST, and put file into a variable, then raise an exception.

The local variables will contain a file which is not serializable.

girardinsamuel commented 2 years ago

So we could at first try to serialize in a nice way internal masonite classes: