A representation of a generalised software issue, complete with the location of the problem.
More...
#include <Errors.hpp>
|
| Error () noexcept |
|
| Error (const Error &other) noexcept |
| Constructs a copy of an existing instance.
|
|
| Error (const std::string &message, const std::exception &original) noexcept |
| Constructs an Error object with a synthesised message combining the provided message, and the error message output of the supplied original exception.
|
|
| Error (Error &&other) noexcept |
| Constructs an object by transferring ownership of resources from another object.
|
|
| Error (std::string message) noexcept |
| Message constructor that initialises with a supplied message and captures the backtrace for diagnostic purposes.
|
|
| ~Error () noexcept override |
| Safely destroys the object, ensuring any allocated resources are properly freed.
|
|
std::vector< std::string > | frameStack () const noexcept |
| Retrieves the stack frames associated with this instance.
|
|
Error & | operator= (const Error &other) noexcept |
| Assigns the state of the given instance to this instance.
|
|
Error & | operator= (Error &&other) noexcept |
| Assigns the given object to the current instance, transferring ownership of resources if any.
|
|
const char * | what () const noexcept override |
| Retrieves the human-readable description of the error. It is commonly used for logging or display purposes.
|
|
A representation of a generalised software issue, complete with the location of the problem.
◆ Error() [1/5]
pecunia::Error::Error |
( |
| ) |
|
|
noexcept |
Default constructor that initialises with a default message and captures the stack trace.
◆ Error() [2/5]
pecunia::Error::Error |
( |
std::string | message | ) |
|
|
explicitnoexcept |
Message constructor that initialises with a supplied message and captures the backtrace for diagnostic purposes.
- Parameters
-
message | The details providing context about the error to be described in the instance. |
◆ Error() [3/5]
pecunia::Error::Error |
( |
const std::string & | message, |
|
|
const std::exception & | original ) |
|
noexcept |
Constructs an Error object with a synthesised message combining the provided message, and the error message output of the supplied original exception.
- Parameters
-
message | The details providing context about the error to be described in the instance. |
original | The original exception that caused this Error, used to extract additional information. |
◆ Error() [4/5]
pecunia::Error::Error |
( |
const Error & | other | ) |
|
|
noexcept |
Constructs a copy of an existing instance.
It performs a deep copy of the internals, ensuring uniqueness of resources between the original and the copy.
- Parameters
-
other | The other instance to copy from. |
- Postcondition
- The newly constructed object will have the same message and trace information as the original
other
instance.
◆ Error() [5/5]
pecunia::Error::Error |
( |
Error && | other | ) |
|
|
noexcept |
Constructs an object by transferring ownership of resources from another object.
This constructor is used to create a new instance, taking over the existing data and state of another object.
- Parameters
-
other | The other object whose resources will be moved to the newly created object. |
- Postcondition
- The newly created object contains the previous state of the
other
object. The other
object is left in a valid, but unspecified state.
◆ ~Error()
pecunia::Error::~Error |
( |
| ) |
|
|
overridenoexcept |
Safely destroys the object, ensuring any allocated resources are properly freed.
◆ frameStack()
std::vector< std::string > pecunia::Error::frameStack |
( |
| ) |
const |
|
nodiscardnoexcept |
Retrieves the stack frames associated with this instance.
This is used to obtain a backtrace of stack frames that can help in identifying where the error occurred. It generates a detailed trace based on the error’s internal state.
- Returns
- A vector of strings representing the sequence of stack frames of the error’s backtrace. The specific formatting is dependent upon the compiler, but the error’s constructor will /not/ be a part of the trace.
- Note
- The trace is generated on demand, and is not cached.
◆ operator=() [1/2]
Error & pecunia::Error::operator= |
( |
const Error & | other | ) |
|
|
noexcept |
Assigns the state of the given instance to this instance.
This method ensures that all internal states of the current object are replaced by the corresponding states from the other
object. The method aims to establish functional equality between the current instance, and the other
instance.
- Parameters
-
other | The instance whose state will be copied to the current object. |
- Postcondition
- The current instance will contain the same state as the
other
instance.
- Returns
- A reference to the current instance, reflecting the updated state.
◆ operator=() [2/2]
Error & pecunia::Error::operator= |
( |
Error && | other | ) |
|
|
noexcept |
Assigns the given object to the current instance, transferring ownership of resources if any.
- Parameters
-
other | The object that will be assigned to the current instance. |
- Postcondition
- The current instance will contain the data or configuration of the other object.
-
The “other” object will be left in a valid but unspecified state.
- Returns
- The current instance after the assignment.
◆ what()
const char * pecunia::Error::what |
( |
| ) |
const |
|
nodiscardoverridenoexcept |
Retrieves the human-readable description of the error. It is commonly used for logging or display purposes.
- Returns
- The error’s message, which may provide insight into what caused the error.