-
Notifications
You must be signed in to change notification settings - Fork 0
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 #15 from TeskaLabs/Feature/Introduce-exceptions
Introduce exception : PathError, FormatError
- Loading branch information
Showing
6 changed files
with
82 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
class SMTPDeliverError(Exception): | ||
pass | ||
|
||
|
||
class PathError(Exception): | ||
""" | ||
Equivalent to HTTP 404 Not-Found. | ||
""" | ||
|
||
def __init__(self, message=None, *args, path=None): | ||
self.Path = path | ||
if message is not None: | ||
super().__init__(message, *args) | ||
elif path is not None: | ||
message = "Invalid path {!r}.".format(path) | ||
super().__init__(message, *args) | ||
else: | ||
super().__init__(message, *args) | ||
|
||
|
||
class FormatError(Exception): | ||
""" | ||
Equivalent to HTTP 400 Bad-request. | ||
""" | ||
|
||
def __init__(self, message=None, *args, format=None): | ||
self.Format = format | ||
if message is not None: | ||
super().__init__(message, *args) | ||
elif format is not None: | ||
message = "Unsupported template format {!r}.".format(format) | ||
super().__init__(message, *args) | ||
else: | ||
super().__init__(message, *args) | ||
|
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