Fix response model for crawl errors API endpoint (#1939)
Follow-up fix for #1920 for crawl errors endpoint, which returns a 500 following #1928, caught in nightly tests.
This commit is contained in:
parent
335700e683
commit
c772ee2362
@ -41,6 +41,7 @@ from .models import (
|
|||||||
User,
|
User,
|
||||||
PaginatedCrawlOutResponse,
|
PaginatedCrawlOutResponse,
|
||||||
PaginatedSeedResponse,
|
PaginatedSeedResponse,
|
||||||
|
PaginatedCrawlErrorResponse,
|
||||||
RUNNING_AND_STARTING_STATES,
|
RUNNING_AND_STARTING_STATES,
|
||||||
SUCCESSFUL_STATES,
|
SUCCESSFUL_STATES,
|
||||||
NON_RUNNING_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")
|
raise HTTPException(status_code=400, detail="crawl_not_finished")
|
||||||
|
|
||||||
@app.get(
|
@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(
|
async def get_crawl_errors(
|
||||||
crawl_id: str,
|
crawl_id: str,
|
||||||
|
@ -930,6 +930,17 @@ class CrawlScaleResponse(BaseModel):
|
|||||||
scaled: int
|
scaled: int
|
||||||
|
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
class CrawlError(BaseModel):
|
||||||
|
"""Crawl error"""
|
||||||
|
|
||||||
|
timestamp: str
|
||||||
|
logLevel: str
|
||||||
|
context: str
|
||||||
|
message: str
|
||||||
|
details: Any
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
### UPLOADED CRAWLS ###
|
### UPLOADED CRAWLS ###
|
||||||
@ -2223,3 +2234,10 @@ class PaginatedWebhookNotificationResponse(PaginatedResponse):
|
|||||||
"""Response model for paginated webhook notifications"""
|
"""Response model for paginated webhook notifications"""
|
||||||
|
|
||||||
items: List[WebhookNotification]
|
items: List[WebhookNotification]
|
||||||
|
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
class PaginatedCrawlErrorResponse(PaginatedResponse):
|
||||||
|
"""Response model for crawl errors"""
|
||||||
|
|
||||||
|
items: List[CrawlError]
|
||||||
|
Loading…
Reference in New Issue
Block a user