Django-Requests-Tracker icon indicating copy to clipboard operation
Django-Requests-Tracker copied to clipboard

Handle `KeyError` when request details is not existing anymore

Open AlTosterino opened this issue 1 year ago • 1 comments

Hey!

Currently, if you are on __request__tracker__ and restart the app, request tracker throws unhandled KeyError if you want to go into request details (which is not saved anywhere at this moment)

 File "/python3.11/site-packages/requests_tracker/views.py", line 118, in request_details
    context = request.request_collectors[UUID(str(request_id))].get_as_context()
              │       │                  │        └ 'bf1f647d-d71e-4ab9-a23a-b9268ead6e10'
              │       │                  └ <class 'uuid.UUID'>
              │       └ {}
              └ <ASGIRequest: GET '/__requests_tracker__/request-details/bf1f647d-d71e-4ab9-a23a-b9268ead6e10'>

KeyError: UUID('bf1f647d-d71e-4ab9-a23a-b9268ead6e10')

AlTosterino avatar Apr 18 '24 12:04 AlTosterino

Thanks! I'll take a look.

bensi94 avatar Apr 18 '24 21:04 bensi94