Skip to content

Commit 127314a

Browse files
committed
sigstore: fixup exc types
Signed-off-by: William Woodruff <william@trailofbits.com>
1 parent 916f925 commit 127314a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sigstore/_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ def _verify_identity(args: argparse.Namespace) -> None:
839839
)
840840

841841
print(f"OK: {file}")
842-
except VerificationError as exc:
842+
except Error as exc:
843843
_logger.error(f"FAIL: {file}")
844844
exc.log_and_exit(_logger, args.verbose >= 1)
845845

@@ -896,7 +896,7 @@ def _verify_github(args: argparse.Namespace) -> None:
896896
policy=policy_,
897897
)
898898
print(f"OK: {file}")
899-
except VerificationError as exc:
899+
except Error as exc:
900900
_logger.error(f"FAIL: {file}")
901901
exc.log_and_exit(_logger, args.verbose >= 1)
902902

sigstore/dsse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from sigstore_protobuf_specs.io.intoto import Envelope as _Envelope
3030
from sigstore_protobuf_specs.io.intoto import Signature
3131

32-
from sigstore.errors import VerificationError
32+
from sigstore.errors import Error, VerificationError
3333
from sigstore.hashes import Hashed
3434

3535
_logger = logging.getLogger(__name__)
@@ -101,7 +101,7 @@ def __init__(self, contents: bytes) -> None:
101101
try:
102102
self._inner = _Statement.model_validate_json(contents)
103103
except ValidationError:
104-
raise ValueError("malformed in-toto statement")
104+
raise Error("malformed in-toto statement")
105105

106106
def _matches_digest(self, digest: Hashed) -> bool:
107107
"""
@@ -181,7 +181,7 @@ def build(self) -> Statement:
181181
predicate=self._predicate,
182182
)
183183
except ValidationError as e:
184-
raise ValueError(f"invalid statement: {e}")
184+
raise Error(f"invalid statement: {e}")
185185

186186
return Statement(stmt.model_dump_json(by_alias=True).encode())
187187

0 commit comments

Comments
 (0)