From 98bf9bd26dfd3d48d6d75e1ecdf53eedae81cc08 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 31 Oct 2024 13:48:01 -0700 Subject: [PATCH] feat: add URL detection and viewer for error messages --- aider/coders/base_coder.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 8afe0d8a1..cd8288193 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1138,7 +1138,13 @@ class Coder: self.io.tool_warning(str(err)) retry_delay *= 2 if retry_delay > RETRY_TIMEOUT: - #ai look for a URL in the str(err) and confirm_ask if they want to view it! + # Check for URLs in error message + 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): + import webbrowser + webbrowser.open(url) break self.io.tool_output(f"Retrying in {retry_delay:.1f} seconds...") time.sleep(retry_delay)