Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
@@ -142,8 +142,9 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE
|
|
142 |
error_details = exc.errors()
|
143 |
error_messages = []
|
144 |
for error in error_details:
|
|
|
145 |
msg = error['msg']
|
146 |
-
error_messages.append(msg)
|
147 |
error_message = "; ".join(error_messages) if error_messages else ""
|
148 |
response_json = {'urls': urls, 'scraped_texts': '', 'scrape_errors': '', 'summaries': "", 'summarizer_error': f'Validation Error: {error_message}'}
|
149 |
json_str = json.dumps(response_json, indent=5) # convert dict to JSON str
|
|
|
142 |
error_details = exc.errors()
|
143 |
error_messages = []
|
144 |
for error in error_details:
|
145 |
+
loc = '->'.join(map(str, error['loc']))
|
146 |
msg = error['msg']
|
147 |
+
error_messages.append(f"{loc}: {msg}")
|
148 |
error_message = "; ".join(error_messages) if error_messages else ""
|
149 |
response_json = {'urls': urls, 'scraped_texts': '', 'scrape_errors': '', 'summaries': "", 'summarizer_error': f'Validation Error: {error_message}'}
|
150 |
json_str = json.dumps(response_json, indent=5) # convert dict to JSON str
|