Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions codonPython/mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .mesh import MESHConnection, generate_authorization
from .exceptions import (
MESHAuthenticationError,
MESHDownloadErrors,
MESHInvalidRecipient,
MESHMessageAlreadyDownloaded,
MESHMessageMissing,
MESHMultipleMatches,
MESHUnknownError,
)
56 changes: 56 additions & 0 deletions codonPython/mesh/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from requests.exceptions import ConnectionError


class MESHAuthenticationError(ConnectionError):
"""The MESH request authentication was invalid"""

@property
def msg(self):
return "Invalid authentication"


class MESHMessageMissing(ConnectionError):
"""The message requested does not exist"""

@property
def msg(self):
return "Message does not exist"


class MESHMessageAlreadyDownloaded(ConnectionError):
"""The MESH request has already been downloaded"""

@property
def msg(self):
return "Message already downloaded"


class MESHDownloadErrors(Exception):
"""There were errors downloading MESH messages"""

def __init__(self, exceptions):
self.exceptions = exceptions


class MESHInvalidRecipient(ConnectionError):
"""The recipient is unknown or otherwise invalid"""

@property
def msg(self):
return "Invalid recipient"


class MESHMultipleMatches(ConnectionError):
"""There are multiple messages with the provided local ID"""

@property
def msg(self):
return "Multiple messages found"


class MESHUnknownError(ConnectionError):
"""There was an unknown error with the connection"""

@property
def msg(self):
return "Unknown"
Loading