Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions api/openrouter_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,23 +320,26 @@ async def content_generator():
yield "Error: No response content from OpenRouter API"

return content_generator()
except aiohttp.ClientError as e_client:
except aiohttp.ClientError as e:
e_client = e
log.error(f"Connection error with OpenRouter API: {str(e_client)}")

# Return a generator that yields the error message
async def connection_error_generator():
yield f"Connection error with OpenRouter API: {str(e_client)}. Please check your internet connection and that the OpenRouter API is accessible."
return connection_error_generator()

except RequestException as e_req:
except RequestException as e:
e_req = e
log.error(f"Error calling OpenRouter API asynchronously: {str(e_req)}")

# Return a generator that yields the error message
async def request_error_generator():
yield f"Error calling OpenRouter API: {str(e_req)}"
return request_error_generator()

except Exception as e_unexp:
except Exception as e:
e_unexp = e
log.error(f"Unexpected error calling OpenRouter API asynchronously: {str(e_unexp)}")

# Return a generator that yields the error message
Expand Down