Skip to content

Commit

Permalink
Handle missing data more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed May 8, 2024
1 parent d4ae1a5 commit 14f1802
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/butlerexampleservice/handlers/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
external_router = APIRouter()
"""FastAPI router for all external handlers."""

from fastapi import HTTPException
from lsst.daf.butler import LabeledButlerFactory
from safir.dependencies.gafaelfawr import auth_delegated_token_dependency

Expand All @@ -33,6 +34,8 @@ def get_coadd_url(
)

ref = butler.find_dataset("deepCoadd", dataId={"tract": tract, "patch": patch})
if ref is None:
raise HTTPException(status_code=404, detail="Coadd not found")
return str(butler.getURI(ref))


Expand Down

0 comments on commit 14f1802

Please sign in to comment.