4 #ifndef FACE_SDK_EXCEPTION_H
5 #define FACE_SDK_EXCEPTION_H
12 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
20 #pragma warning(disable:4275)
21 #pragma warning(disable:4251)
56 class FACE_SDK_EXPORT
exception :
public std::exception
64 std::string type_name()
const;
66 virtual const char* what()
const noexcept
override;
71 std::string _type_name;
74 #define DEFINE_FACE_SDK_EXCEPTION(x) \
76 class FACE_SDK_EXPORT x : public exception \
80 { _type_name = std::string(#x); } \
82 explicit x(const std::string &message) \
83 : exception(message) \
84 { _type_name = std::string(#x); } \
87 DEFINE_FACE_SDK_EXCEPTION(runtime_exception);
89 DEFINE_FACE_SDK_EXCEPTION(internal_error_exception);
91 DEFINE_FACE_SDK_EXCEPTION(out_of_range_exception);
93 DEFINE_FACE_SDK_EXCEPTION(invalid_parameter_exception);
95 DEFINE_FACE_SDK_EXCEPTION(file_exception);
97 DEFINE_FACE_SDK_EXCEPTION(file_not_found_exception);
99 DEFINE_FACE_SDK_EXCEPTION(bad_image_data_exception);
101 DEFINE_FACE_SDK_EXCEPTION(bad_image_format_exception);
103 DEFINE_FACE_SDK_EXCEPTION(signature_mismatch_exception);
105 DEFINE_FACE_SDK_EXCEPTION(incompatible_version_exception);
107 DEFINE_FACE_SDK_EXCEPTION(version_not_available_exception);
109 DEFINE_FACE_SDK_EXCEPTION(key_not_found_exception);
111 DEFINE_FACE_SDK_EXCEPTION(key_exists_exception);
113 DEFINE_FACE_SDK_EXCEPTION(data_container_corrupted_exception);
115 DEFINE_FACE_SDK_EXCEPTION(data_container_entries_limit_exceed_exception);
117 DEFINE_FACE_SDK_EXCEPTION(not_implemented_exception);
119 DEFINE_FACE_SDK_EXCEPTION(license_exception);
121 DEFINE_FACE_SDK_EXCEPTION(nvml_exception);
123 DEFINE_FACE_SDK_EXCEPTION(platofrm_not_supported_exception);
125 DEFINE_FACE_SDK_EXCEPTION(not_supported_exception);
127 class FACE_SDK_EXPORT upscale_too_much_exception :
public exception
132 upscale_too_much_exception(
const std::string &message, uint32_t idx) :
exception(message)
134 _type_name =
"upscale_too_much_exception";
147 bool FACE_SDK_EXPORT is_root_exception_of_type(
const std::type_info &tp,
const face_sdk::exception &e);
153 #define FACE_SDK_RETHROW_ROOT(x) try{ x; } catch (const face_sdk::exception &exp ) { rethrow_root_exception(exp); }
156 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
160 #endif //FACE_SDK_EXCEPTION_H