NIST Fingerprint Image Quality 2
Fingerprint image quality assessment tool
nfiq2_exception.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of NIST Fingerprint Image Quality (NFIQ) 2. For more
3  * information on this project, refer to:
4  * - https://nist.gov/services-resources/software/nfiq2
5  * - https://github.com/usnistgov/NFIQ2
6  *
7  * This work is in the public domain. For complete licensing details, refer to:
8  * - https://github.com/usnistgov/NFIQ2/blob/master/LICENSE.md
9  */
10 
11 #ifndef NFIQ2_EXCEPTION_HPP_
12 #define NFIQ2_EXCEPTION_HPP_
13 
14 #include <exception>
15 #include <string>
16 
17 namespace NFIQ2 {
18 
20 enum class ErrorCode {
36 };
37 
39 class Exception : public std::exception {
40  public:
48  Exception(const NFIQ2::ErrorCode errorCode);
49 
60  const NFIQ2::ErrorCode errorCode, const std::string &errorMessage);
61 
63  virtual ~Exception() noexcept;
64 
72  virtual const char *what() const noexcept override;
73 
82 
90  std::string getErrorMessage() const;
91 
102  static std::string defaultErrorMessage(
103  const NFIQ2::ErrorCode errorCode);
104 
105  private:
107  const NFIQ2::ErrorCode errorCode { ErrorCode::UnknownError };
109  const std::string errorMessage {};
110 };
111 } // namespace NFIQ
112 
113 #endif /* NFIQ2_EXCEPTION_HPP_ */
Exceptions thrown from NFIQ2 functions.
static std::string defaultErrorMessage(const NFIQ2::ErrorCode errorCode)
Obtain a default error message for a given ErrorCode.
Exception(const NFIQ2::ErrorCode errorCode)
Constructor that supplies a default error description.
Exception(const NFIQ2::ErrorCode errorCode, const std::string &errorMessage)
Constructor that relies on a developer-provided error description.
std::string getErrorMessage() const
Obtain a description of what happened.
virtual ~Exception() noexcept
Destructor.
virtual const char * what() const noexcept override
Extracts thrown exception error message string.
NFIQ2::ErrorCode getErrorCode() const
Obtain the code that broadly describes the type of error.
Classes and functions that contribute to the calculation of NFIQ 2 quality scores.
Definition: nfiq2.hpp:97
ErrorCode
Error codes used within the NFIQ2 namespace.