projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add copyright to grammar.
[python_utils.git]
/
exceptions.py
diff --git
a/exceptions.py
b/exceptions.py
index 3ce94d365774422252ab591303907d31ff65d1ba..bd499886221ba55e044a739e835fdc4af8c98c6e 100644
(file)
--- a/
exceptions.py
+++ b/
exceptions.py
@@
-1,13
+1,31
@@
#!/usr/bin/env python3
#!/usr/bin/env python3
+# © Copyright 2021-2022, Scott Gasch
+
+"""Some exceptions used elsewhere."""
+
+# This module is commonly used by others in here and should avoid
+# taking any unnecessary dependencies back on them.
+
+
class PreconditionException(AssertionError):
class PreconditionException(AssertionError):
+ """Use to indicate function preconditions violated."""
+
pass
class PostconditionException(AssertionError):
pass
class PostconditionException(AssertionError):
+ """Use to indicate function postconditions violated."""
+
pass
class TimeoutError(Exception):
pass
class TimeoutError(Exception):
- pass
+ """Use to indicate an operation that timed out."""
+
+ def __init__(self, value: str = "Timed out"):
+ super().__init__()
+ self.value = value
+ def __str__(self):
+ return repr(self.value)