Add builder exceptions
This commit is contained in:
parent
c68a58136c
commit
062cb9f012
3 changed files with 37 additions and 0 deletions
16
src/newsreader/news/collection/exceptions/__init__.py
Normal file
16
src/newsreader/news/collection/exceptions/__init__.py
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
from newsreader.news.collection.exceptions.builder import (
|
||||||
|
BuilderDuplicateException,
|
||||||
|
BuilderException,
|
||||||
|
BuilderMissingDataException,
|
||||||
|
BuilderParseException,
|
||||||
|
)
|
||||||
|
from newsreader.news.collection.exceptions.stream import (
|
||||||
|
StreamConnectionException,
|
||||||
|
StreamDeniedException,
|
||||||
|
StreamException,
|
||||||
|
StreamForbiddenException,
|
||||||
|
StreamNotFoundException,
|
||||||
|
StreamParseException,
|
||||||
|
StreamTimeOutException,
|
||||||
|
StreamTooManyException,
|
||||||
|
)
|
||||||
21
src/newsreader/news/collection/exceptions/builder.py
Normal file
21
src/newsreader/news/collection/exceptions/builder.py
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
class BuilderException(Exception):
|
||||||
|
message = "Builder exception"
|
||||||
|
|
||||||
|
def __init__(self, payload=None, message=None):
|
||||||
|
self.payload = payload
|
||||||
|
self.message = message if message else self.message
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.message
|
||||||
|
|
||||||
|
|
||||||
|
class BuilderMissingDataException(BuilderException):
|
||||||
|
message = "Payload contains missing data"
|
||||||
|
|
||||||
|
|
||||||
|
class BuilderDuplicateException(BuilderException):
|
||||||
|
message = "Payload contains duplicate entry"
|
||||||
|
|
||||||
|
|
||||||
|
class BuilderParseException(BuilderException):
|
||||||
|
message = "Failed to parse payload"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue