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
15 changes: 14 additions & 1 deletion src/daq_queuing_service/api/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from blueapi.client.rest import InvalidParametersError, UnknownPlanError
from blueapi.client.rest import (
InvalidParametersError,
ServiceUnavailableError,
UnknownPlanError,
)
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse

Expand All @@ -15,6 +19,15 @@


def register_exception_handlers(app: FastAPI):
@app.exception_handler(ServiceUnavailableError)
async def service_unavailable_error(
request: Request, exception: ServiceUnavailableError
):
return JSONResponse(
status_code=409,
content={"error": "blueapi_unavailable", "message": str(exception)},
)

@app.exception_handler(TaskInProgressError)
async def task_in_progress_handler(
request: Request, exception: TaskInProgressError
Expand Down
5 changes: 0 additions & 5 deletions src/daq_queuing_service/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

from ._config import load_config

LOCAL_BLUEAPI_URL = "http://localhost:8000/"
I15_1_BLUEAPI_URL = "https://i15-1-blueapi.diamond.ac.uk/"
STOMP_URL = "tcp://localhost:61613"


logging.basicConfig(
level=logging.INFO, format="%(asctime)s [%(name)s] %(levelname)s: %(message)s"
)
Expand Down
Loading