owenrusk.dev

tally

shamir's secret sharing over gf(256).

git clone https://owenrusk.dev/tally.git

commit 09e2f240336967d4d3779f3bc000df5af6448bda
parent 7422d9b9ec8d29fe3279d27ff4840d20b8c829f7
author Owen Rusk <owen@papermothgames.com>
date   2024-12-03 15:20:46 -0600
cli: plain errors instead of tracebacks

a bad k or a missing file printed a traceback.
tally/cli.py+5-1
diff --git a/tally/cli.py b/tally/cli.py
index 9bd1c1e..6b70758 100644
--- a/tally/cli.py
+++ b/tally/cli.py
@@ -41,6 +41,10 @@ def main(argv: list[str] | None = None) -> int:
     args = parser.parse_args(argv)
     try:
         return args.func(args)
-    except ShareError as e:
+    except ValueError as e:
+        # ShareError is a ValueError too
         print(f"tally: {e}", file=sys.stderr)
         return 1
+    except OSError as e:
+        print(f"tally: {e.filename}: {(e.strerror or str(e)).lower()}", file=sys.stderr)
+        return 1