Base exception type for the suite. More...
#include <StormByte/exception.hxx>

Classes | |
| struct | Path |
| Segments under StormByte, already joined with a dot. More... | |
Public Member Functions | |
| Exception (std::string_view message) | |
| Copies text into StormByte: message. | |
| Exception (const Exception &other) | |
| Copy constructor. | |
| Exception (Exception &&other) noexcept | |
| Move constructor. | |
| virtual | ~Exception () noexcept |
| Destructor. | |
| Exception & | operator= (const Exception &other) |
| Copy assignment. | |
| Exception & | operator= (Exception &&other) noexcept |
| Move assignment. | |
| virtual const char * | what () const noexcept |
| Message pointer. | |
Protected Member Functions | |
| Exception () noexcept | |
| Construct without allocating message storage. | |
| Exception (Path path, std::string_view message) | |
Stores StormByte.path: message, or StormByte: message when path is empty. | |
| Exception (Path path, Safe::String &&message) | |
| Stores StormByte.path: message, taking the body. | |
| template<typename... Args> requires (sizeof...(Args) >= 1) | |
| Exception (Path path, std::string_view pattern, Args &&... args) | |
| Stores StormByte.path: message after replacing literal {}. | |
Base exception type for the suite.
what() is StormByte: message, or StormByte.path: message when a parent passes the segments under StormByte (Safe, Crypto.Crypter). Segments are joined with a dot. The body is a StormByte::Safe::String and does not repeat the path.
A parent passes Path, a std::string_view that lives for the constructor call and is not stored. A bare string is not a path. The token constructor is protected and replaces literal {} with Safe::String::ReplaceToken. It does not call std::format. A derived class uses it. A throw site that is not a derived constructor builds a Safe::String and moves it in.
A parent prepends its own segment and forwards the pattern and the arguments. A final leaf adds no segment. Copy, move and the destructor of each named type are defined in that module's .cxx, so the typeinfo is unique across a DLL.
A leaf that must not allocate uses the empty constructor and overrides what. That leaf does not fill m_what. The message constructor takes a view. A Safe::String converts to that view and is copied.
|
explicit |
Copies text into StormByte: message.
| message | Exception text. Not a format string. A Safe::String converts to this view. |
| StormByte::Exception::Exception | ( | const Exception & | other | ) |
|
noexcept |
|
virtualnoexcept |
Destructor.
Defined in the Base DLL: this anchors the typeinfo.
Reimplemented in StormByte::Safe::Exception.
|
protectednoexcept |
Construct without allocating message storage.
Used by a leaf that overrides what with a static string.
|
protected |
|
protected |
Stores StormByte.path: message, taking the body.
| path | Segments under StormByte. |
| message | Body. Moved. Not scanned for tokens. |
|
inlineprotected |
Stores StormByte.path: message after replacing literal {}.
| Args | Views, numbers, or types that convert to std::string. A number uses std::to_string. |
| path | Segments under StormByte. |
| pattern | Body with literal {} tokens. Not a std::format string. |
| args | Replacements. One per token, in order. |
Move assignment.
Defined in the Base DLL.
| other | Exception to take. other stays valid. |
|
virtualnoexcept |
Message pointer.
A leaf may override this and return static storage.
Reimplemented in StormByte::Safe::AllocationError, and StormByte::Safe::BadOptionalAccess.