diff options
| author | J08nY | 2021-05-19 11:12:21 +0200 |
|---|---|---|
| committer | J08nY | 2021-05-19 11:12:21 +0200 |
| commit | aca8a78813938fc8b655d669fe92e70818cf891c (patch) | |
| tree | 637501583e65b1aaf7d43107783101b1a8bb127b /pyecsca/ec | |
| parent | 68d4a84b3ec8a699d3390dee763fb5ef078c60ee (diff) | |
| download | pyecsca-aca8a78813938fc8b655d669fe92e70818cf891c.tar.gz pyecsca-aca8a78813938fc8b655d669fe92e70818cf891c.tar.zst pyecsca-aca8a78813938fc8b655d669fe92e70818cf891c.zip | |
Properly raise warnings.
Diffstat (limited to 'pyecsca/ec')
| -rw-r--r-- | pyecsca/ec/error.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pyecsca/ec/error.py b/pyecsca/ec/error.py index fac4aac..87ca335 100644 --- a/pyecsca/ec/error.py +++ b/pyecsca/ec/error.py @@ -1,4 +1,5 @@ """This module contains exceptions and warnings used in the library.""" +import warnings from public import public from ..misc.cfg import getconfig @@ -27,7 +28,7 @@ def raise_non_invertible(): if cfg.ec.no_inverse_action == "error": raise NonInvertibleError("Element not invertible.") elif cfg.ec.no_inverse_action == "warning": - raise NonInvertibleWarning("Element not invertible.") + warnings.warn(NonInvertibleWarning("Element not invertible.")) @public @@ -54,7 +55,7 @@ def raise_non_residue(): if cfg.ec.non_residue_action == "error": raise NonResidueError("No square root exists.") elif cfg.ec.non_residue_action == "warning": - raise NonResidueWarning("No square root exists.") + warnings.warn(NonResidueWarning("No square root exists.")) @public @@ -80,4 +81,4 @@ def raise_unsatisified_assumption(action: str, msg: str): if action == "error": raise UnsatisfiedAssumptionError(msg) elif action == "warning": - raise UnsatisfiedAssumptionWarning(msg) + warnings.warn(UnsatisfiedAssumptionWarning(msg)) |
