mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +00:00
feat: add custom UnknownEditFormat exception with documentation link
This commit is contained in:
parent
bbd81c3cf7
commit
75bc2dd564
3 changed files with 8 additions and 2 deletions
|
@ -22,7 +22,7 @@ from typing import List
|
|||
from aider import __version__, models, prompts, urls, utils
|
||||
from aider.analytics import Analytics
|
||||
from aider.commands import Commands
|
||||
from aider.exceptions import LiteLLMExceptions
|
||||
from aider.exceptions import LiteLLMExceptions, UnknownEditFormat
|
||||
from aider.history import ChatSummary
|
||||
from aider.io import ConfirmGroup, InputOutput
|
||||
from aider.linter import Linter
|
||||
|
@ -157,7 +157,8 @@ class Coder:
|
|||
res.original_kwargs = dict(kwargs)
|
||||
return res
|
||||
|
||||
raise ValueError(f"Unknown edit format {edit_format}")
|
||||
valid_formats = [c.edit_format for c in coders.__all__ if hasattr(c, "edit_format")]
|
||||
raise UnknownEditFormat(edit_format, valid_formats)
|
||||
|
||||
def clone(self, **kwargs):
|
||||
new_coder = Coder.create(from_coder=self, **kwargs)
|
||||
|
|
|
@ -765,6 +765,10 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
chat_language=args.chat_language,
|
||||
detect_urls=args.detect_urls,
|
||||
)
|
||||
except UnknownEditFormat as err:
|
||||
io.tool_error(str(err))
|
||||
io.offer_url(urls.edit_formats, "Open documentation about edit formats?")
|
||||
return 1
|
||||
except ValueError as err:
|
||||
io.tool_error(str(err))
|
||||
return 1
|
||||
|
|
|
@ -13,3 +13,4 @@ git_index_version = "https://github.com/Aider-AI/aider/issues/211"
|
|||
install_properly = "https://aider.chat/docs/troubleshooting/imports.html"
|
||||
analytics = "https://aider.chat/docs/more/analytics.html"
|
||||
release_notes = "https://aider.chat/HISTORY.html#release-notes"
|
||||
edit_formats = "https://aider.chat/docs/more/edit-formats.html"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue