lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
3.09k stars 264 forks source link

draft of PrettyPrintApiException #1520

Closed MalteEbner closed 5 months ago

MalteEbner commented 6 months ago

Description (version 2):

Change ApiException toPrettyPrintApiException(ApiException), which prints it much more nicely (formatting, print relevant part in bold and red). I kept it inheriting from ApiException to ensure that the calling code can still catch it if needed.

Effects

1) Shortens the stacktrace a bit 2) Prints the ApiException more nicely.

Stacktrace still there

We will not overwrite the sys.excepthook, see discussion with Guarin here, as it is too hacky and might cause problems among users of the library.

Screenshots

image image image

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 33.33333% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 81.78%. Comparing base (9bda4ee) to head (f5f8f90).

Files Patch % Lines
lightly/api/swagger_rest_client.py 29.03% 22 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1520 +/- ## ========================================== - Coverage 82.09% 81.78% -0.31% ========================================== Files 144 144 Lines 6070 6090 +20 ========================================== - Hits 4983 4981 -2 - Misses 1087 1109 +22 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MalteEbner commented 6 months ago

Update after discussion with Jeremy: