From 9dd195ddd3bce8183a43f9653e7caec5dd0a23ee Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Tue, 15 Sep 2015 14:32:43 +0200 Subject: Nutze ein Enum zur leichteren ReturnCodeverwaltung --- crypt/cryptexception.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'crypt/cryptexception.h') diff --git a/crypt/cryptexception.h b/crypt/cryptexception.h index 1141969..7f70211 100644 --- a/crypt/cryptexception.h +++ b/crypt/cryptexception.h @@ -2,18 +2,32 @@ #define CRYPTEXCEPTION_H #include + #include class CryptException : public std::exception { public: + /** + * @brief The ReturnCode enum + */ + enum ReturnCode + { + FileNotFound = 1, + FileNotWritable, + DecryptionErrorRsa, + DecryptionErrorAes, + OpenSslError, + KeyNotRsa + }; + /** * @brief CryptException * Erzeugt eine Exception mit den angegebenen Werten. * @param what Die Fehlermeldung, die dem Nutzer gezeigt wird. * @param returnCode Der Rückgabewert für die Konsole. */ - CryptException(std::string what, int returnCode); + CryptException(std::string what, ReturnCode returnCode); /** * @brief ~CryptException @@ -32,11 +46,11 @@ public: * Gibt den Konsolenrückgabewert zurück. * @return Der Rückgabewert für die Konsole. */ - int returnCode() const; + ReturnCode returnCode() const; private: std::string whatMsg; - int retId; + ReturnCode retId; }; -- cgit v1.2.3-70-g09d2