78 template <
typename... Args>
79 Exception(std::format_string<Args...> fmt, Args&&... args) {
80 if constexpr (
sizeof...(Args) == 0) {
81 m_what = copy_str(std::string(fmt.get()).c_str());
83 std::string formatted_message = std::format(fmt, std::forward<Args>(args)...);
84 m_what = copy_str(formatted_message.c_str());
96 template <
typename... Args>
98 std::string formatted_message = std::format(fmt, std::forward<Args>(args)...);
99 std::string full_message =
"StormByte::" + std::string(component.
name) +
": " + formatted_message;
100 m_what = copy_str(full_message.c_str());
138 virtual const
char* what() const noexcept;
148 const
char* copy_str(const
char* str) noexcept;
153 void free_str() noexcept;
162 using Exception::Exception;
171 using Exception::Exception;
180 using Exception::Exception;
189 using Exception::Exception;
198 using Exception::Exception;
Thrown when Base64 encode or decode fails.
Definition exception.hxx:178
Thrown when deserialization fails.
Definition exception.hxx:160
Base exception type for the suite.
Definition exception.hxx:57
Exception(const std::string &message)
Constructs from a string.
Exception(std::string &&message)
Constructs from a moved string.
Exception(Exception &&e) noexcept
Move constructor.
Exception(const Exception &e)
Copy constructor.
Exception(Component component, std::format_string< Args... > fmt, Args &&... args)
Constructs with a component prefix and std::format.
Definition exception.hxx:97
Exception(std::format_string< Args... > fmt, Args &&... args)
Constructs with std::format.
Definition exception.hxx:79
virtual ~Exception() noexcept
Destructor.
Thrown when an index or range is out of bounds.
Definition exception.hxx:169
Thrown when a System helper cannot obtain a path or create a temporary file.
Definition exception.hxx:196
Thrown when UTF-8 or wide-string input contains invalid Unicode.
Definition exception.hxx:187
Root namespace of the StormByte suite.
Wraps a module name for the component-prefixed Exception constructor.
Definition exception.hxx:41
constexpr Component(std::string_view name) noexcept
Wraps name.
Definition exception.hxx:48
std::string_view name
Module name inserted after StormByte::.
Definition exception.hxx:42
#define STORMBYTE_PUBLIC
Definition visibility.h:28