mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
style: format long error messages with line breaks
This commit is contained in:
parent
b2bcca967f
commit
3b2f1f1e66
1 changed files with 16 additions and 5 deletions
|
@ -796,15 +796,26 @@ class Coder:
|
||||||
friendly_msg = None
|
friendly_msg = None
|
||||||
|
|
||||||
if isinstance(exc, (openai.APITimeoutError, openai.APIConnectionError)):
|
if isinstance(exc, (openai.APITimeoutError, openai.APIConnectionError)):
|
||||||
friendly_msg = "The API provider is having connectivity issues. Please try again in a moment."
|
friendly_msg = (
|
||||||
|
"The API provider is having connectivity issues. Please try again in a moment."
|
||||||
|
)
|
||||||
elif isinstance(exc, openai.RateLimitError):
|
elif isinstance(exc, openai.RateLimitError):
|
||||||
friendly_msg = "The API provider's rate limits have been exceeded. Please wait a moment before trying again."
|
friendly_msg = (
|
||||||
|
"The API provider's rate limits have been exceeded. Please wait a moment before"
|
||||||
|
" trying again."
|
||||||
|
)
|
||||||
elif isinstance(exc, openai.InternalServerError):
|
elif isinstance(exc, openai.InternalServerError):
|
||||||
friendly_msg = "The API provider is experiencing internal issues. Please try again later."
|
friendly_msg = (
|
||||||
|
"The API provider is experiencing internal issues. Please try again later."
|
||||||
|
)
|
||||||
elif isinstance(exc, openai.BadRequestError):
|
elif isinstance(exc, openai.BadRequestError):
|
||||||
friendly_msg = "The request was invalid. This might be due to the API provider changing their API."
|
friendly_msg = (
|
||||||
|
"The request was invalid. This might be due to the API provider changing their API."
|
||||||
|
)
|
||||||
elif isinstance(exc, openai.AuthenticationError):
|
elif isinstance(exc, openai.AuthenticationError):
|
||||||
friendly_msg = "There was an issue with your API authentication. Please check your API key."
|
friendly_msg = (
|
||||||
|
"There was an issue with your API authentication. Please check your API key."
|
||||||
|
)
|
||||||
|
|
||||||
if friendly_msg:
|
if friendly_msg:
|
||||||
self.io.tool_error(f"{friendly_msg}\nTechnical details: {text}")
|
self.io.tool_error(f"{friendly_msg}\nTechnical details: {text}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue