Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1847 improve handling when djdt views dont respond with json #1877

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion debug_toolbar/static/debug_toolbar/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ function ajax(url, init) {
return fetch(url, init)
.then(function (response) {
if (response.ok) {
return response.json();
return response.json().catch(function(error){
return Promise.reject(
new Error("The response is a invalid Json object : " + error)
);
});
tim-schilling marked this conversation as resolved.
Show resolved Hide resolved
}
return Promise.reject(
new Error(response.status + ": " + response.statusText)
Expand Down
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Pending
* Raised the minimum Django version to 4.2.
* Automatically support Docker rather than having the developer write a
workaround for ``INTERNAL_IPS``.
* Display a better error message when the toolbar's requests
return invalid json.

4.3.0 (2024-02-01)
------------------
Expand Down
Loading