1#ifndef IV_SRC_CORE_EXCEPTION_HPP_
2#define IV_SRC_CORE_EXCEPTION_HPP_
94 Exception(
const char *prefix, std::string_view msg) :
m_msg(fmt::format(
"{} {}", prefix, msg))
98 Exception(std::string_view msg,
const std::exception &e) :
m_msg(fmt::format(
"{} failed with {}", msg, e.
what()))
104 [[nodiscard]] virtual int64_t
errorCode() const noexcept
114 [[nodiscard]]
const char *
what() const noexcept
override
116 return m_msg.c_str();
134 :
iv::exception::
Exception(fmt::format(
"{} in {}", msg, where))
155 :
InvalidArgument(fmt::format(
"Unknown field '{}' for algorithm {}", field_name, algo_name))
167 :
InvalidArgument(fmt::format(
"{} cannot accept a key of length {}", name, length))
184 :
InvalidArgument(fmt::format(
"IV length {} is invalid for {}", badLength, mode))
301 LookupError(std::string_view type, std::string_view algo, std::string_view provider =
"");
319 :
LookupError(fmt::format(
"Could not find any algorithm named '{}'", name))
335 :
LookupError(fmt::format(
"Could not find provider '{}' for algorithm '{}'", provider, algo))
414 [[nodiscard]] int64_t
errorCode() const noexcept
override
448 NotImplemented(
const std::string_view err, std::optional<std::string_view> file, std::optional<uint32_t> line)
449 :
Exception(fmt::format(
"Not implemented: {}", err))
451 if (file.has_value() && line.has_value())
453 m_msg += fmt::format(
" at {}:{}", file.value(), line.value());
467 :
Exception(fmt::format(
"Integer overflow detected at {}:{}", file, line))
528template<
typename E,
typename... Args>
529inline void doThrowError(
const char *file,
int line,
const char *func, Args... args)
531 throw E(file, line, func, args...);
545 explicit MissingCase(std::string_view msg, std::string_view where) :
Exception(fmt::format(
"{} in {}", msg, where))
576 :
Exception(fmt::format(
"Out of bounds memory access: {}", msg))
Definition exception.hpp:316
AlgorithmNotFound(std::string_view name)
Definition exception.hpp:318
Definition exception.hpp:226
DecodingError(std::string_view category, std::string_view err)
Definition exception.hpp:232
DecodingError(const std::string_view msg, const std::exception &e)
Definition exception.hpp:236
DecodingError(const std::string_view name)
Definition exception.hpp:228
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:240
Definition exception.hpp:210
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:216
EncodingError(const std::string_view name)
Definition exception.hpp:212
Definition exception.hpp:88
virtual eExceptionType exceptionType() const noexcept
Definition exception.hpp:109
virtual int64_t errorCode() const noexcept
Definition exception.hpp:104
std::string m_msg
Definition exception.hpp:120
Exception(std::string_view msg, const std::exception &e)
Definition exception.hpp:98
Exception(const std::string_view msg)
Definition exception.hpp:90
Exception(const char *prefix, std::string_view msg)
Definition exception.hpp:94
const char * what() const noexcept override
Definition exception.hpp:114
~Exception() noexcept override=default
Definition exception.hpp:508
FileNameNotAvailable(std::string_view file)
Definition exception.hpp:510
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:514
Definition exception.hpp:495
FileNotFound(std::string_view file)
Definition exception.hpp:497
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:501
Definition exception.hpp:478
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:488
FolderNotFound()
Definition exception.hpp:484
FolderNotFound(std::string_view folder)
Definition exception.hpp:480
Definition exception.hpp:521
ImpossibleLabelingError(const std::string &msg)
Definition exception.hpp:523
Definition exception.hpp:464
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:471
IntegerOverflowDetected(std::string_view file, int line)
Definition exception.hpp:466
Definition exception.hpp:427
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:433
InternalError(const std::string_view err)
Definition exception.hpp:429
Definition exception.hpp:198
InvalidAlgorithmName(std::string_view name)
Definition exception.hpp:200
Definition exception.hpp:127
InvalidArgument(const std::string_view msg, const std::exception &e)
Definition exception.hpp:138
InvalidArgument(std::string_view msg, std::string_view where)
Definition exception.hpp:133
InvalidArgument(const std::string_view msg)
Definition exception.hpp:129
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:142
Definition exception.hpp:347
InvalidAuthenticationTag(const std::string_view msg)
Definition exception.hpp:349
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:353
Definition exception.hpp:376
InvalidFileIntegrity(const std::string_view err)
Definition exception.hpp:378
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:382
Definition exception.hpp:181
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:188
InvalidIVLength(std::string_view mode, size_t badLength)
Definition exception.hpp:183
Definition exception.hpp:164
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:171
InvalidKeyLength(std::string_view name, size_t length)
Definition exception.hpp:166
Definition exception.hpp:251
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:257
InvalidState(const std::string_view err)
Definition exception.hpp:253
Definition exception.hpp:279
KeyNotSet(std::string_view algo)
Definition exception.hpp:281
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:285
Definition exception.hpp:560
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:566
LibZipError(std::string_view msg)
Definition exception.hpp:562
Definition exception.hpp:295
LookupError(const std::string_view err)
Definition exception.hpp:297
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:303
Definition exception.hpp:538
MissingCase(std::string_view msg, std::string_view where)
Definition exception.hpp:545
MissingCase(const std::string_view msg)
Definition exception.hpp:540
MissingCase(const std::string_view msg, const std::exception &e)
Definition exception.hpp:549
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:553
Definition exception.hpp:446
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:457
NotImplemented(const std::string_view err, std::optional< std::string_view > file, std::optional< uint32_t > line)
Definition exception.hpp:448
Definition exception.hpp:573
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:580
OutOfBoundsMemoryAccess(std::string_view msg)
Definition exception.hpp:575
Definition exception.hpp:267
PRNGUnseeded(std::string_view algo)
Definition exception.hpp:269
Definition exception.hpp:332
ProviderNotFound(std::string_view algo, std::string_view provider)
Definition exception.hpp:334
Definition exception.hpp:363
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:369
StreamIOError(const std::string_view err)
Definition exception.hpp:365
Definition exception.hpp:398
eExceptionType exceptionType() const noexcept override
Definition exception.hpp:409
SystemError(std::string_view msg, int errCode)
Definition exception.hpp:404
int64_t m_errorCode
Definition exception.hpp:420
int64_t errorCode() const noexcept override
Definition exception.hpp:414
SystemError(const std::string_view msg)
Definition exception.hpp:400
Definition exception.hpp:152
UnknownPKFieldName(std::string_view algo_name, std::string_view field_name)
Definition exception.hpp:154
Definition exceptions.hpp:7
void doThrowError(const char *file, int line, const char *func, Args... args)
Definition exception.hpp:529
std::string toString(const iv::exception::eExceptionType type)
Definition exception.cpp:6
eExceptionType
Definition exception.hpp:13
@ OutOfBoundsMemoryAccess
Definition AlarmsManager.cpp:18