mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge branch 'dev-3.x' into dev-3.x-remove-filters-factory
# Conflicts: # docs/dispatcher/filters/index.rst
This commit is contained in:
commit
1f8ca990b5
3 changed files with 19 additions and 0 deletions
1
CHANGES/988.feature
Normal file
1
CHANGES/988.feature
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Added message text to aiogram exceptions representation
|
||||||
|
|
@ -20,6 +20,9 @@ class DetailedAiogramError(AiogramError):
|
||||||
message += f"\n(background on this error at: {self.url})"
|
message += f"\n(background on this error at: {self.url})"
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f"{type(self).__name__}('{self}')"
|
||||||
|
|
||||||
|
|
||||||
class TelegramAPIError(DetailedAiogramError):
|
class TelegramAPIError(DetailedAiogramError):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
||||||
15
tests/test_api/test_types/test_exception.py
Normal file
15
tests/test_api/test_types/test_exception.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from aiogram.exceptions import DetailedAiogramError
|
||||||
|
|
||||||
|
|
||||||
|
class TestException:
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"message,result",
|
||||||
|
[
|
||||||
|
["reason", "DetailedAiogramError('reason')"],
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_representation(self, message: str, result: str):
|
||||||
|
exc = DetailedAiogramError(message=message)
|
||||||
|
assert repr(exc) == result
|
||||||
Loading…
Add table
Add a link
Reference in a new issue