Skip to content
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
2 changes: 1 addition & 1 deletion acceptance/bundle/resources/alerts/basic/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Deleting files...
Destroy complete!

>>> [CLI] alerts-v2 get-alert [ALERT_ID]
Error: Node with resource name None does not exist.
Error: Alert with ID '[ALERT_ID]' does not exist.

Exit code: 1

Expand Down
7 changes: 4 additions & 3 deletions libs/testserver/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,13 @@ func AddDefaultHandlers(server *Server) {
server.Handle("GET", "/api/2.0/alerts/{id}", func(req Request) any {
defer req.Workspace.LockUnlock()()

value, ok := req.Workspace.Alerts[req.Vars["id"]]
id := req.Vars["id"]

value, ok := req.Workspace.Alerts[id]
if !ok || value.LifecycleState == sql.AlertLifecycleStateDeleted {
return Response{
StatusCode: 404,
// Backend returns a terrible error message today.
Body: map[string]string{"message": "Node with resource name None does not exist."},
Body: map[string]string{"message": "Alert with ID '" + id + "' does not exist."},
}
}

Expand Down