From e01d85cdb9f675470b294368586f4da07d274fef Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Tue, 19 Mar 2019 13:42:03 +0100 Subject: [PATCH] common: Create error class for missing msoffcrypto --- oletools/common/errors.py | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/oletools/common/errors.py b/oletools/common/errors.py index f492011..d16cd55 100644 --- a/oletools/common/errors.py +++ b/oletools/common/errors.py @@ -8,6 +8,15 @@ class CryptoErrorBase(ValueError): """Base class for crypto-based exceptions.""" pass + +class CryptoLibNotImported(CryptoErrorBase, ImportError): + """Exception thrown if msoffcrypto is needed but could not be imported.""" + + def __init__(self): + super(CryptoLibNotImported, self).__init__( + 'msoffcrypto-tools could not be imported') + + class UnsupportedEncryptionError(CryptoErrorBase): """Exception thrown if file is encrypted and cannot deal with it.""" def __init__(self, filename=None): -- libgit2 0.21.4