diff --git a/backend/btrixcloud/crawls.py b/backend/btrixcloud/crawls.py index d1e6215b..7e8966e9 100644 --- a/backend/btrixcloud/crawls.py +++ b/backend/btrixcloud/crawls.py @@ -41,6 +41,7 @@ from .models import ( User, PaginatedCrawlOutResponse, PaginatedSeedResponse, + PaginatedCrawlErrorResponse, RUNNING_AND_STARTING_STATES, SUCCESSFUL_STATES, NON_RUNNING_STATES, @@ -1471,7 +1472,9 @@ def init_crawls_api(crawl_manager: CrawlManager, app, user_dep, *args): raise HTTPException(status_code=400, detail="crawl_not_finished") @app.get( - "/orgs/{oid}/crawls/{crawl_id}/errors", tags=["crawls"], response_model=bytes + "/orgs/{oid}/crawls/{crawl_id}/errors", + tags=["crawls"], + response_model=PaginatedCrawlErrorResponse, ) async def get_crawl_errors( crawl_id: str, diff --git a/backend/btrixcloud/models.py b/backend/btrixcloud/models.py index 184df795..f1fc7ae9 100644 --- a/backend/btrixcloud/models.py +++ b/backend/btrixcloud/models.py @@ -930,6 +930,17 @@ class CrawlScaleResponse(BaseModel): scaled: int +# ============================================================================ +class CrawlError(BaseModel): + """Crawl error""" + + timestamp: str + logLevel: str + context: str + message: str + details: Any + + # ============================================================================ ### UPLOADED CRAWLS ### @@ -2223,3 +2234,10 @@ class PaginatedWebhookNotificationResponse(PaginatedResponse): """Response model for paginated webhook notifications""" items: List[WebhookNotification] + + +# ============================================================================ +class PaginatedCrawlErrorResponse(PaginatedResponse): + """Response model for crawl errors""" + + items: List[CrawlError]