Skip to content

Fix status api 404 on empty listings - #124

Merged
pmrich merged 2 commits into
doe-iri:mainfrom
mbeards-pnnl:status-api-empty-list-not-404
Sep 8, 2026
Merged

pmrich merged 2 commits into
doe-iri:mainfrom
mbeards-pnnl:status-api-empty-list-not-404

Conversation

@mbeards-pnnl

Copy link
Copy Markdown
Contributor

Resolves #109

This PR makes the status api for incidents and events consistent with the other listing api calls in IRI by returning an empty array rather than throwing a 404 when there are no incidents or events to return.

… lists not 404 if there are no incidents or events
Comment thread app/routers/status/status.py Outdated
)
if not incidents:
raise HTTPException(status_code=404, detail="No incidents found")
return incidents

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just add a return to the previous line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@pmrich pmrich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pmrich
pmrich merged commit 75574da into doe-iri:main Sep 8, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status API events and incidents return 404 instead of empty list

3 participants