Skip to content

Commit 6a432df

Browse files
committed
fix: restored specialized exceptions
1 parent 23e41c2 commit 6a432df

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pymdoccbor/mdoc/exceptions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class MissingPrivateKey(Exception):
2+
pass
3+
4+
class NoDocumentTypeProvided(Exception):
5+
pass
6+
7+
class NoSignedDocumentProvided(Exception):
8+
pass
9+
10+
class MissingIssuerAuth(Exception):
11+
pass

pymdoccbor/mdoc/verifier.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from pymdoccbor.exceptions import InvalidMdoc
88
from pymdoccbor.mdoc.issuersigned import IssuerSigned
9+
from pymdoccbor.mdoc.exceptions import NoDocumentTypeProvided, NoSignedDocumentProvided
910

1011
logger = logging.getLogger('pymdoccbor')
1112

@@ -30,12 +31,12 @@ def __init__(self, docType: str, issuerSigned: dict, deviceSigned: dict = {}) ->
3031
"""
3132

3233
if not docType:
33-
raise ValueError("You must provide a document type")
34+
raise NoDocumentTypeProvided("You must provide a document type")
3435

3536
self.doctype: str = docType # eg: 'org.iso.18013.5.1.mDL'
3637

3738
if not issuerSigned:
38-
raise ValueError("You must provide a signed document")
39+
raise NoSignedDocumentProvided("You must provide a signed document")
3940

4041
self.issuersigned: List[IssuerSigned] = IssuerSigned(**issuerSigned)
4142
self.is_valid = False

0 commit comments

Comments
 (0)