feat: добавлен класс MaxError для обработки исключений - #184
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
love-apples
requested changes
Aug 12, 2026
love-apples
left a comment
Owner
There was a problem hiding this comment.
@matytsyn поправь пожалуйста ruff
Contributor
Author
|
@love-apples фикс есть в #183, может сначала его смержить, потом сделать ребейз этого pr? |
Contributor
Author
|
а, у меня тоже может упасть, сейчас поправлю свои фиксы |
Collaborator
|
Ага, блокируется исправлениями #183 |
Contributor
There was a problem hiding this comment.
Pull request overview
Добавляет общий базовый класс MaxError для собственных исключений библиотеки.
Changes:
- Добавлен и экспортирован
MaxError. - Существующие исключения переведены на новую иерархию.
- Добавлены тесты наследования и совместимости.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
maxapi/exceptions/base.py |
Определяет MaxError. |
maxapi/exceptions/__init__.py |
Экспортирует новый класс. |
maxapi/exceptions/max.py |
Обновляет исключения API и соединения. |
maxapi/exceptions/dispatcher.py |
Обновляет исключения диспетчера. |
maxapi/exceptions/download_file.py |
Обновляет исключения скачивания. |
tests/test_exceptions_hierarchy.py |
Проверяет новую иерархию. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
matytsyn
force-pushed
the
maxerror-class
branch
from
August 15, 2026 10:05
5b352db to
6b7d677
Compare
Contributor
Author
|
@love-apples поправил ruff, ошибок нет |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что изменилось?
Ввёл общий базовый класс
MaxErrorдля всех исключений библиотеки. Теперь любую ошибку можно поймать однимexcept MaxError.Зачем?
До этого изменения исключения библиотеки не имели общего предка:
MaxApiErrorнаследовался отExceptionInvalidToken,MaxConnection,MaxUploadFileFailed,MaxIconParamsException— отExceptionHandlerException,MiddlewareException— отExceptionDownloadFileError,NotAvailableForDownload— отExceptionПриходилось перечислять все классы через кортеж или же ловить голый
Exception, который пропускает посторонние баги.Совместимость
Все существующие классы исключений и их публичные атрибуты сохранены.
Раньше все они наследовались от
Exception, теперь наследуются отMaxError, который сам является подклассомException. Существующий код сexcept Exception,except MaxApiErrorи т.п. продолжает работатьфиксит часть #176