mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
refactor: extract URL checking logic into separate method
This commit is contained in:
parent
1ef60b5a40
commit
2b7584b651
1 changed files with 1 additions and 9 deletions
|
@ -1157,15 +1157,7 @@ class Coder:
|
||||||
self.io.tool_warning(err_msg)
|
self.io.tool_warning(err_msg)
|
||||||
retry_delay *= 2
|
retry_delay *= 2
|
||||||
if retry_delay > RETRY_TIMEOUT:
|
if retry_delay > RETRY_TIMEOUT:
|
||||||
# Check for URLs in error message
|
self.check_and_offer_urls(str(err))
|
||||||
# ai: refactor this into a function
|
|
||||||
url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*[^\s,.])")
|
|
||||||
urls = url_pattern.findall(str(err))
|
|
||||||
for url in urls:
|
|
||||||
if self.io.confirm_ask(
|
|
||||||
"View this URL from the error message?", subject=url
|
|
||||||
):
|
|
||||||
webbrowser.open(url)
|
|
||||||
break
|
break
|
||||||
self.io.tool_output(f"Retrying in {retry_delay:.1f} seconds...")
|
self.io.tool_output(f"Retrying in {retry_delay:.1f} seconds...")
|
||||||
time.sleep(retry_delay)
|
time.sleep(retry_delay)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue