diff options
| author | Árni Dagur <arni@dagur.eu> | 2021-06-26 16:20:29 +0000 |
|---|---|---|
| committer | Árni Dagur <arni@dagur.eu> | 2021-06-26 19:10:50 +0000 |
| commit | fb1832feb868a81e2d10a1707c57df4623304313 (patch) | |
| tree | f77f31d340f19b0e4d96a92ccc23cdeb6b135738 /adblock | |
| parent | 0d5c8b8cfa1025c29b96db3c52ff54a7d204923f (diff) | |
Create a custom exception type for this library
Diffstat (limited to 'adblock')
| -rw-r--r-- | adblock/__init__.py | 29 | ||||
| -rw-r--r-- | adblock/adblock.pyi | 21 |
2 files changed, 48 insertions, 2 deletions
diff --git a/adblock/__init__.py b/adblock/__init__.py index 0cc1876..85d3614 100644 --- a/adblock/__init__.py +++ b/adblock/__init__.py | |||
| @@ -1,4 +1,29 @@ | |||
| 1 | from adblock.adblock import __version__, Engine, FilterSet, BlockerResult, UrlSpecificResources | 1 | from adblock.adblock import ( |
| 2 | __version__, | ||
| 3 | Engine, | ||
| 4 | FilterSet, | ||
| 5 | BlockerResult, | ||
| 6 | UrlSpecificResources, | ||
| 7 | AdblockException, | ||
| 8 | BlockerException, | ||
| 9 | SerializationError, | ||
| 10 | DeserializationError, | ||
| 11 | OptimizedFilterExistence, | ||
| 12 | BadFilterAddUnsupported, | ||
| 13 | FilterExists, | ||
| 14 | ) | ||
| 2 | 15 | ||
| 3 | 16 | ||
| 4 | __all__ = ("Engine", "FilterSet", "BlockerResult", "UrlSpecificResources") | 17 | __all__ = ( |
| 18 | "Engine", | ||
| 19 | "FilterSet", | ||
| 20 | "BlockerResult", | ||
| 21 | "UrlSpecificResources", | ||
| 22 | "AdblockException", | ||
| 23 | "BlockerException", | ||
| 24 | "SerializationError", | ||
| 25 | "DeserializationError", | ||
| 26 | "OptimizedFilterExistence", | ||
| 27 | "BadFilterAddUnsupported", | ||
| 28 | "FilterExists", | ||
| 29 | ) | ||
diff --git a/adblock/adblock.pyi b/adblock/adblock.pyi index d977629..0515674 100644 --- a/adblock/adblock.pyi +++ b/adblock/adblock.pyi | |||
| @@ -1,5 +1,26 @@ | |||
| 1 | from typing import Optional, Dict, List, Set | 1 | from typing import Optional, Dict, List, Set |
| 2 | 2 | ||
| 3 | class AdblockException(Exception): | ||
| 4 | pass | ||
| 5 | |||
| 6 | class BlockerException(AdblockException): | ||
| 7 | pass | ||
| 8 | |||
| 9 | class SerializationError(BlockerException): | ||
| 10 | pass | ||
| 11 | |||
| 12 | class DeserializationError(BlockerException): | ||
| 13 | pass | ||
| 14 | |||
| 15 | class OptimizedFilterExistence(BlockerException): | ||
| 16 | pass | ||
| 17 | |||
| 18 | class BadFilterAddUnsupported(BlockerException): | ||
| 19 | pass | ||
| 20 | |||
| 21 | class FilterExists(BlockerException): | ||
| 22 | pass | ||
| 23 | |||
| 3 | class BlockerResult: | 24 | class BlockerResult: |
| 4 | matched: bool | 25 | matched: bool |
| 5 | explicit_cancel: bool | 26 | explicit_cancel: bool |
