POSTs that are not form data and technical_500.txt

60 views
Skip to first unread message

f.holop

unread,
Oct 11, 2022, 12:36:46 PM10/11/22
to django-d...@googlegroups.com
Hello,

fishing for some ideas here. consider this scenario:

```
...
Subject: [Django] ERROR (EXTERNAL IP): Internal Server Error: /c/add/
...
Internal Server Error: /c/add/

UnboundLocalError at /c/add/
local variable 'model' referenced before assignment
...
Traceback (most recent call last):
...
Exception Type: UnboundLocalError at /c/add/
Exception Value: local variable 'model' referenced before assignment
Request information:
USER: AnonymousUser

GET: No GET data

POST: No POST data

FILES: No FILES data
...
```

i love technical_500.txt. my collegues are continually amazed how i
knew they ran into an issue a minute ago and simple fixes are pushed
immediately with no other triaging involved.

but in this case it's borderline useless. what happened?
request.POST vs request.data happened.

i am not advocating putting optional package info into technical_500 of
course (request.data is a drf construct iirc).

but would it be feasable to show (a part of) request.body if method is POST
and Content-Type is application/json (perhaps xml could be handled
similarly)?

ps. why not a custom middleware? i think this is a battery that would
be nice :}

-f
--
Reply all
Reply to author
Forward
0 new messages