I am working on a middleware where i need to convert the HTTPResponse(ex: 500 internal error) to a JSONResponse like below
{
"error":"some error string",
"traceback":"complete traceback of exception"
}
Can someone please guide me how i can achieve this?
We can use the EXCEPTION_HANDLER in REST for this job.