diff --git a/src/teuthology_api/routes/kill.py b/src/teuthology_api/routes/kill.py index 7ad7a4a..93b103c 100644 --- a/src/teuthology_api/routes/kill.py +++ b/src/teuthology_api/routes/kill.py @@ -37,8 +37,8 @@ async def create_run( except HTTPError as http_err: log.error(http_err) raise HTTPException( - status_code=http_err.response.status_code, detail=repr(http_err) + status_code=http_err.response.status_code, detail=str(http_err, "utf-8") ) from http_err except Exception as err: log.error(err) - raise HTTPException(status_code=500, detail=repr(err)) from err + raise HTTPException(status_code=500, detail=str(err, "utf-8")) from err diff --git a/src/teuthology_api/services/helpers.py b/src/teuthology_api/services/helpers.py index 8de5365..b1638ce 100644 --- a/src/teuthology_api/services/helpers.py +++ b/src/teuthology_api/services/helpers.py @@ -63,11 +63,11 @@ def get_run_details(run_name: str): except HTTPError as http_err: log.error(http_err) raise HTTPException( - status_code=http_err.response.status_code, detail=repr(http_err) + status_code=http_err.response.status_code, detail=str(http_err, "utf-8") ) from http_err except Exception as err: log.error(err) - raise HTTPException(status_code=500, detail=repr(err)) from err + raise HTTPException(status_code=500, detail=str(err, "utf-8")) from err def get_username(request: Request): diff --git a/src/teuthology_api/services/kill.py b/src/teuthology_api/services/kill.py index 3c6872d..e5fa385 100644 --- a/src/teuthology_api/services/kill.py +++ b/src/teuthology_api/services/kill.py @@ -67,4 +67,4 @@ async def run(args, send_logs: bool, token: dict, request: Request): return {"kill": "success"} except Exception as exc: log.error("teuthology-kill command failed with the error: %s", repr(exc)) - raise HTTPException(status_code=500, detail=repr(exc)) from exc + raise HTTPException(status_code=500, detail=str(exc, "utf-8")) from exc diff --git a/src/teuthology_api/services/suite.py b/src/teuthology_api/services/suite.py index 99d2d6d..af9d699 100644 --- a/src/teuthology_api/services/suite.py +++ b/src/teuthology_api/services/suite.py @@ -43,7 +43,7 @@ def run(args, send_logs: bool, access_token: str): return {"run": run_details} except Exception as exc: log.error("teuthology.suite.main failed with the error: %s", repr(exc)) - raise HTTPException(status_code=500, detail=repr(exc)) from exc + raise HTTPException(status_code=500, detail=str(exc, "utf-8")) from exc def make_run_name(run_dic):