MCPcopy
hub / github.com/Aider-AI/aider / get_ex_info

Method get_ex_info

aider/exceptions.py:80–108  ·  view source on GitHub ↗

Return the ExInfo for a given exception instance

(self, ex)

Source from the content-addressed store, hash-verified

78 return tuple(self.exceptions)
79
80 def get_ex_info(self, ex):
81 """Return the ExInfo for a given exception instance"""
82 import litellm
83
84 if ex.__class__ is litellm.APIConnectionError:
85 if "boto3" in str(ex):
86 return ExInfo("APIConnectionError", False, "You need to: pip install boto3")
87 if "OpenrouterException" in str(ex) and "'choices'" in str(ex):
88 return ExInfo(
89 "APIConnectionError",
90 True,
91 (
92 "OpenRouter or the upstream API provider is down, overloaded or rate"
93 " limiting your requests."
94 ),
95 )
96
97 # Check for specific non-retryable APIError cases like insufficient credits
98 if ex.__class__ is litellm.APIError:
99 err_str = str(ex).lower()
100 if "insufficient credits" in err_str and '"code":402' in err_str:
101 return ExInfo(
102 "APIError",
103 False,
104 "Insufficient credits with the API provider. Please add credits.",
105 )
106 # Fall through to default APIError handling if not the specific credits error
107
108 return self.exceptions.get(ex.__class__, ExInfo(None, None, None))

Callers 7

send_messageMethod · 0.95
test_get_ex_infoFunction · 0.95
test_rate_limit_errorFunction · 0.95
test_openrouter_errorFunction · 0.95
sendMethod · 0.80

Calls 1

ExInfoClass · 0.85

Tested by 4

test_get_ex_infoFunction · 0.76
test_rate_limit_errorFunction · 0.76
test_openrouter_errorFunction · 0.76