NIST Fingerprint Image Quality 2
NIST reference implementation fingerprint image quality analyzer.
nfiq2_exception.hpp
Go to the documentation of this file.
1 #ifndef NFIQ2_EXCEPTION_HPP_
2 #define NFIQ2_EXCEPTION_HPP_
3 
4 #include <exception>
5 #include <map>
6 #include <string>
7 
8 namespace NFIQ2 {
9 
11 enum class ErrorCode {
27 };
28 
30 static const std::map<NFIQ2::ErrorCode, std::string> errorCodeMessage {
31  { NFIQ2::ErrorCode::UnknownError, "Unknown error" },
32  { NFIQ2::ErrorCode::NotEnoughMemory, "Not enough memory" },
33  { NFIQ2::ErrorCode::BadArguments, "Bad arguments" },
35  "Feature calculation error" },
36  { NFIQ2::ErrorCode::CannotWriteToFile, "Cannot write to file" },
37  { NFIQ2::ErrorCode::CannotReadFromFile, "Cannot read from file" },
38  { NFIQ2::ErrorCode::NoDataAvailable, "No data available" },
39  { NFIQ2::ErrorCode::CannotDecodeBase64, "Cannot decode base64 string" },
41  "An invalid configuration entry was found" },
43  "An machine learning error occurred" },
45  "Cannot create context for FJFX feature extractor" },
47  "Cannot create feature set from fingerprint data" },
49  "No feature set could be created" },
50  { NFIQ2::ErrorCode::InvalidNFIQ2Score, "Invalid NFIQ2 Score" },
51  { NFIQ2::ErrorCode::InvalidImageSize, "Invalid Image Size" }
52 };
53 
55 class Exception : public std::exception {
56  public:
64  Exception(const NFIQ2::ErrorCode &errorCode);
65 
77  const NFIQ2::ErrorCode &errorCode, const std::string &errorMessage);
78 
80  virtual ~Exception() noexcept;
81 
89  virtual const char *what() const noexcept;
90 
99 
107  std::string getErrorMessage() const;
108 
109  private:
111  NFIQ2::ErrorCode errorCode;
113  std::string errorMessage;
114 };
115 } // namespace NFIQ
116 
117 #endif /* NFIQ2_EXCEPTION_HPP_ */
Exceptions thrown from NFIQ2 functions.
Exception(const NFIQ2::ErrorCode &errorCode, const std::string &errorMessage)
Constructor which uses supplied error code and user-defined message.
std::string getErrorMessage() const
Obtain the error message of the exception.
virtual ~Exception() noexcept
Destructor.
NFIQ2::ErrorCode getErrorCode() const
Obtain the return code of the exception.
virtual const char * what() const noexcept
Extracts thrown exception error message string.
Exception(const NFIQ2::ErrorCode &errorCode)
Constructor which uses supplied error code and default message.
Classes and functions that contribute to the calculation of NFIQ2 scores.
Definition: nfiq2.hpp:25
ErrorCode
Error codes used within the NFIQ2 namespace.