MCPcopy
hub / github.com/wandb/openui / boto3_error_handler

Function boto3_error_handler

backend/openui/server.py:241–262  ·  view source on GitHub ↗
(request: Request, exc: ClientError)

Source from the content-addressed store, hash-verified

239
240@app.exception_handler(ClientError)
241async def boto3_error_handler(request: Request, exc: ClientError):
242 logger.exception("Boto3 Error: %s", exc)
243 error_code = exc.response["Error"]["Code"]
244 error_message = exc.response["Error"]["Message"]
245
246 status_code_map = {
247 "NoSuchKey": 404,
248 "NoSuchBucket": 404,
249 "AccessDenied": 403,
250 # TODO: maybe add more...
251 }
252 status_code = status_code_map.get(error_code, 500)
253
254 return JSONResponse(
255 status_code=status_code,
256 content={
257 "error": {
258 "code": error_code,
259 "message": error_message,
260 }
261 },
262 )
263
264
265@app.exception_handler(Exception)

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected