errorlib: Sentry logging improvements
- Adds a security check by catching and sending to Sentry any exception which could occur during the process of the original exception for Sentry.
- Adds a "SentryEncoder", it is a simple encoder which will avoid to raise exception by trying to encode all the object. First it will try to get the dict by calling the dict attribute. If it fails then it will try to cast the object as a string.
This is needed because sometimes we get non serializable objects from mod_wsgi. By preprocessing data thanks to this encoder we can ensure that the whole data will be serializable.
This method has been implemented because in the future if someone want to improve how we manage non serializable object by improving the encoder, it is possible.
- (closes #2535) (PR #2546)
Signed-off-by: Guillaume Lastecoueres <guillaume@tind.io>
Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>