Skip to content

Commit

Permalink
Fixed server error JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
susuhahnml committed Dec 3, 2024
1 parent dbbcbfd commit a377df7
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions clinguin/utils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_server_error_alert(message="", last_response=None):
{
"id": "server_error",
"key": "message",
"value": message + " Check the server logs for more details.",
"value": message + " (Check the server logs for more details).",
},
{"id": "server_error", "key": "title", "value": "Server error"},
{"id": "server_error", "key": "type", "value": "danger"},
Expand All @@ -36,22 +36,25 @@ def get_server_error_alert(message="", last_response=None):

if last_response is None:
return {
"id": "root",
"type": "root",
"parent": "root",
"attributes": [],
"when": [],
"children": [
{
"id": "window",
"type": "window",
"parent": "root",
"attributes": [],
"when": [],
"children": [error_alert],
}
],
"ui": {
"id": "root",
"type": "root",
"parent": "root",
"attributes": [],
"when": [],
"children": [
{
"id": "window",
"type": "window",
"parent": "root",
"attributes": [],
"when": [],
"children": [error_alert],
}
],
},
"ds": {},
}

last_response.children[0].children.append(error_alert)
last_response["ui"].children[0].children.append(error_alert)
return last_response

0 comments on commit a377df7

Please sign in to comment.