-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from sirji-ai/throw-specific-exception
Added specific exception from message parsing
- Loading branch information
Showing
9 changed files
with
297 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
class MessageValidationError(Exception): | ||
class MessageMissingPropertyError(Exception): | ||
"""Exception raised for errors in the input message format.""" | ||
|
||
def __init__(self, message="Invalid message format"): | ||
def __init__(self, message="Message does not contain required property"): | ||
self.message = message | ||
super().__init__(self.message) | ||
|
||
class MessageUnRecognizedActionError(Exception): | ||
"""Exception raised for errors in the input message format.""" | ||
|
||
def __init__(self, message="Action is not recognized"): | ||
self.message = message | ||
super().__init__(self.message) | ||
|
||
class MessageIncorrectFormatError(Exception): | ||
"""Exception raised for errors in the input message format.""" | ||
|
||
def __init__(self, message="Message must start and end with ***"): | ||
self.message = message | ||
super().__init__(self.message) | ||
|
||
class MessageParsingError(Exception): | ||
"""Exception raised for errors in parsing the message contents.""" | ||
class MessageLengthConstraintError(Exception): | ||
"""Exception raised for errors in the input message format.""" | ||
|
||
def __init__(self, message="Error parsing message"): | ||
def __init__(self, message="Message does not meet the minimum length requirement"): | ||
self.message = message | ||
super().__init__(self.message) | ||
|
||
class MessageMultipleActionError(Exception): | ||
"""Exception raised for errors in the input message format.""" | ||
|
||
def __init__(self, message="Message contains more than one ACTION keyword"): | ||
self.message = message | ||
super().__init__(self.message) |
This file contains 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
Oops, something went wrong.