Skip to content

Commit

Permalink
sigstore: fixup exc types
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed May 13, 2024
1 parent 916f925 commit 127314a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sigstore/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ def _verify_identity(args: argparse.Namespace) -> None:
)

print(f"OK: {file}")
except VerificationError as exc:
except Error as exc:
_logger.error(f"FAIL: {file}")
exc.log_and_exit(_logger, args.verbose >= 1)

Expand Down Expand Up @@ -896,7 +896,7 @@ def _verify_github(args: argparse.Namespace) -> None:
policy=policy_,
)
print(f"OK: {file}")
except VerificationError as exc:
except Error as exc:
_logger.error(f"FAIL: {file}")
exc.log_and_exit(_logger, args.verbose >= 1)

Expand Down
6 changes: 3 additions & 3 deletions sigstore/dsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from sigstore_protobuf_specs.io.intoto import Envelope as _Envelope
from sigstore_protobuf_specs.io.intoto import Signature

from sigstore.errors import VerificationError
from sigstore.errors import Error, VerificationError
from sigstore.hashes import Hashed

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

def _matches_digest(self, digest: Hashed) -> bool:
"""
Expand Down Expand Up @@ -181,7 +181,7 @@ def build(self) -> Statement:
predicate=self._predicate,
)
except ValidationError as e:
raise ValueError(f"invalid statement: {e}")
raise Error(f"invalid statement: {e}")

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

Expand Down

0 comments on commit 127314a

Please sign in to comment.