Enrollment 28.2.0
Loading...
Searching...
No Matches
ImageException.h
Go to the documentation of this file.
1
9
10#pragma once
11
14#include <cstdint>
15#include <sstream>
16#include <string>
17
18namespace inno
19{
23 */
25 {
26 public:
29 */
30 enum Reason : uint8_t
31 {
49 };
50
54 */
55 [[nodiscard]] Reason GetReason() const
56 {
57 return reason;
58 }
59
67 */
69 : EnrollmentRuntimeException(Message(r), std::move(loc))
70 , reason(r)
71 {
72 }
73
79 */
80 ImageException(Reason r, std::string d, SourceLocation loc = SourceLocation())
81 : EnrollmentRuntimeException(std::move(d), std::move(loc))
82 , reason(r)
83 {
84 }
85
86 private:
87 Reason reason;
88
89 [[nodiscard]] static std::string Message(Reason r)
90 {
91 switch (r)
92 {
93 case Reason::UNKNOWN_IMAGE:
94 return "Not supported image type";
95
96 case Reason::DECODE_IMAGE:
97 return "Not possible to decode image";
98
99 case Reason::ENCODE_IMAGE:
100 return "Not possible to encode image";
101
102 case Reason::PROCESS_IMAGE:
103 return "Not possible to process image";
104 }
105
106 return "Unknown reason";
107 }
108 };
109
110} // namespace inno
Base exception for all enrollment-sdk runtime exceptions.
Definition EnrollmentException.h:84
Reason GetReason() const
ImageException reason.
Definition ImageException.h:54
ImageException(Reason r, SourceLocation loc=SourceLocation())
Constructor creates exception with given reason and information about source location.
Definition ImageException.h:67
ImageException(Reason r, std::string d, SourceLocation loc=SourceLocation())
Constructor creates exception with given reason and more specific message.
Definition ImageException.h:79
Reason
Contains all possible reasons of image exception.
Definition ImageException.h:30
@ ENCODE_IMAGE
Problem encode image to given format.
Definition ImageException.h:43
@ PROCESS_IMAGE
Problem to process an image.
Definition ImageException.h:47
@ DECODE_IMAGE
Image type is supported but image format is corrupted.
Definition ImageException.h:39
@ UNKNOWN_IMAGE
Image type is not supported.
Definition ImageException.h:35
Class to capture the source location of an error or exception.
Definition SourceLocation.h:25