Error messages not received from Django to Javascript

Our web hosted software does not correctly receive error messages. Error is generated in Django (Python) but Javascript does not receive it properly, just a generic “error” text.

This does not happen on local configuration, just when going through Cloudflare.

The Django code:

error = JsonResponse()
if error is not None:
response.status_code = 400
response.reason_phrase = “Custom defined error message”
return response

In our local PCs (without Cloudflare), we are able to extract the “custom defined error message” with the following Javascript code:

error: function(data){
$(“#message_rows2”).text(data.statusText);
$(‘#errorPrinting’).modal(“show”);
}

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.