Commit e01d85cdb9f675470b294368586f4da07d274fef
1 parent
651d81b4
common: Create error class for missing msoffcrypto
Showing
1 changed file
with
9 additions
and
0 deletions
oletools/common/errors.py
| ... | ... | @@ -8,6 +8,15 @@ class CryptoErrorBase(ValueError): |
| 8 | 8 | """Base class for crypto-based exceptions.""" |
| 9 | 9 | pass |
| 10 | 10 | |
| 11 | + | |
| 12 | +class CryptoLibNotImported(CryptoErrorBase, ImportError): | |
| 13 | + """Exception thrown if msoffcrypto is needed but could not be imported.""" | |
| 14 | + | |
| 15 | + def __init__(self): | |
| 16 | + super(CryptoLibNotImported, self).__init__( | |
| 17 | + 'msoffcrypto-tools could not be imported') | |
| 18 | + | |
| 19 | + | |
| 11 | 20 | class UnsupportedEncryptionError(CryptoErrorBase): |
| 12 | 21 | """Exception thrown if file is encrypted and cannot deal with it.""" |
| 13 | 22 | def __init__(self, filename=None): | ... | ... |