Fix error handling when API returns empty
Browse files
utils.py
CHANGED
@@ -105,8 +105,7 @@ async def error_handling_wrapper(generator, status_code=200):
|
|
105 |
|
106 |
return new_generator()
|
107 |
except StopAsyncIteration:
|
108 |
-
|
109 |
-
return async_generator(["data: {'error': 'No data returned'}\n\n"])
|
110 |
|
111 |
def post_all_models(token, config, api_list):
|
112 |
all_models = []
|
|
|
105 |
|
106 |
return new_generator()
|
107 |
except StopAsyncIteration:
|
108 |
+
raise HTTPException(status_code=status_code, detail="data: {'error': 'No data returned'}")
|
|
|
109 |
|
110 |
def post_all_models(token, config, api_list):
|
111 |
all_models = []
|