fix: Resolve issue with wrong error message serialization for cognify… (#1413)
… pipeline in backend <!-- .github/pull_request_template.md --> ## Description Resolve issue with cognify backend error message serialization ## Type of Change <!-- Please check the relevant option --> - [x ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Other (please specify): ## Testing Reproduced error it is handled appropriately ## Pre-submission Checklist <!-- Please check all boxes that apply before submitting your PR --> - [ x] **I have tested my changes thoroughly before submitting this PR** - [ x] **This PR contains minimal changes necessary to address the issue/feature** - [ x] My code follows the project's coding standards and style guidelines - [ x] I have added tests that prove my fix is effective or that my feature works - [ x] I have added necessary documentation (if applicable) - [ x] All new and existing tests pass - [ x] I have searched existing PRs to ensure this change hasn't been submitted already - [x ] I have linked any relevant issues in the description - [ x] My commits have clear and descriptive messages ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
commit
53467da224
1 changed files with 2 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import asyncio
|
|||
from uuid import UUID
|
||||
from pydantic import Field
|
||||
from typing import List, Optional
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi import APIRouter, WebSocket, Depends, WebSocketDisconnect
|
||||
from starlette.status import WS_1000_NORMAL_CLOSURE, WS_1008_POLICY_VIOLATION
|
||||
|
|
@ -119,7 +120,7 @@ def get_cognify_router() -> APIRouter:
|
|||
|
||||
# If any cognify run errored return JSONResponse with proper error status code
|
||||
if any(isinstance(v, PipelineRunErrored) for v in cognify_run.values()):
|
||||
return JSONResponse(status_code=420, content=cognify_run)
|
||||
return JSONResponse(status_code=420, content=jsonable_encoder(cognify_run))
|
||||
return cognify_run
|
||||
except Exception as error:
|
||||
return JSONResponse(status_code=409, content={"error": str(error)})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue