Thin final wrappers around the standard exception hierarchy used by VLink.
Each VLink exception type is a final subclass of the corresponding standard exception base and lives inside the vlink::Exception namespace to avoid clashing with application code. Constructors and what() are inherited verbatim; only OperationCancelled overrides what() with a fixed identifier string.
- Class hierarchy
| VLink class | Standard base | Typical usage |
Exception::RuntimeError | std::runtime_error | Generic runtime failure (logger fatal) |
Exception::OutOfRange | std::out_of_range | Index or iterator out of bounds |
Exception::InvalidArgument | std::invalid_argument | Bad function argument |
Exception::LogicError | std::logic_error | Violated precondition |
Exception::DomainError | std::domain_error | Value outside the function domain |
Exception::LengthError | std::length_error | Exceeded implementation limit |
Exception::RangeError | std::range_error | Arithmetic range error |
Exception::OverflowError | std::overflow_error | Arithmetic overflow |
Exception::UnderflowError | std::underflow_error | Arithmetic underflow |
Exception::OperationCancelled | std::exception | Cooperative cancellation observed |
- 注解
Logger throws Exception::RuntimeError whenever a kFatal message is emitted. The logger flushes all sinks before throwing so the application can catch the exception and shut down cleanly.
- Example
try {
VLOG_F(
"Critical failure: ", reason);
std::cerr << e.what() << "\n";
shutdown_cleanup();
}
Generic runtime failure; thrown by the logger on kFatal messages.
Definition: exception.h:90
#define VLOG_F(...)
Definition: logger.h:791