Skip to content

Commit a6d3b85

Browse files
Copilotjokob-sk
andauthored
Fix set-alias endpoint: return HTTP 200 with normalized error key on failure
Agent-Logs-Url: https://github.com/netalertx/NetAlertX/sessions/05ab18a3-4ac2-492d-bb80-67a1cc089bd9 Co-authored-by: jokob-sk <96159884+jokob-sk@users.noreply.github.com>
1 parent 6eaa477 commit a6d3b85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/api_server/api_server_start.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ def api_device_set_alias(mac, payload=None):
587587
result = device_handler.updateDeviceColumn(mac, 'devName', alias)
588588

589589
if not result.get("success"):
590-
return jsonify(result), 404
590+
err = result.get("error") or result.get("message") or f"Failed to update alias for device {mac}"
591+
return jsonify({"success": False, "error": err})
591592

592593
return jsonify(result)
593594

0 commit comments

Comments
 (0)