|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Exception handling system with formatted messages for Aleph-w. More...
#include <stdexcept>#include <sstream>Go to the source code of this file.
Classes | |
| struct | Aleph::ExceptionBuilder< E > |
| Exception constructor with formatted message. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Macros | |
| #define | ah_warning_unless(out, C) |
| Emits a warning to a stream if the condition does NOT hold. | |
| #define | ah_warning_if(out, C) |
| Emits a warning to a stream if the condition holds. | |
| #define | ah_warning(out) (out) << "WARNING (" << __FILE__ << ":" << __LINE__ << ") | " |
| Emits an unconditional warning to a stream. | |
| #define | ah_range_error_unless(C) |
| Throws std::range_error if condition does NOT hold. | |
| #define | ah_range_error_if(C) |
| Throws std::range_error if condition holds. | |
| #define | ah_range_error() |
| Throws std::range_error unconditionally. | |
| #define | ah_range_error_if_constexpr(C) |
| #define | ah_range_error_unless_constexpr(C) |
| #define | ah_runtime_error_unless(C) |
| Throws std::runtime_error if condition does NOT hold. | |
| #define | ah_runtime_error_if(C) |
| Throws std::runtime_error if condition holds. | |
| #define | ah_runtime_error() |
| Throws std::runtime_error unconditionally. | |
| #define | ah_runtime_error_if_constexpr(C) |
| #define | ah_runtime_error_unless_constexpr(C) |
| #define | ah_logic_error_unless(C) |
| Throws std::logic_error if condition does NOT hold. | |
| #define | ah_logic_error_if(C) |
| Throws std::logic_error if condition holds. | |
| #define | ah_logic_error() |
| Throws std::logic_error unconditionally. | |
| #define | ah_logic_error_if_constexpr(C) |
| #define | ah_logic_error_unless_constexpr(C) |
| #define | ah_underflow_error_if(C) |
| Throws std::underflow_error if condition holds. | |
| #define | ah_underflow_error_unless(C) |
| Throws std::underflow_error if condition does NOT hold. | |
| #define | ah_underflow_error() |
| Throws std::underflow_error unconditionally. | |
| #define | ah_underflow_error_if_constexpr(C) |
| #define | ah_underflow_error_unless_constexpr(C) |
| #define | ah_bad_alloc() do { [[unlikely]] throw std::bad_alloc(); } while (false) |
| Throws std::bad_alloc unconditionally (no message stream) | |
| #define | ah_bad_alloc_if(C) do { if (C) [[unlikely]] throw std::bad_alloc(); } while (false) |
| Throws std::bad_alloc if condition holds. | |
| #define | ah_bad_alloc_unless(C) do { if (!(C)) [[unlikely]] throw std::bad_alloc(); } while (false) |
| Throws std::bad_alloc if condition does NOT hold. | |
| #define | ah_bad_alloc_if_constexpr(C) |
| #define | ah_bad_alloc_unless_constexpr(C) |
| #define | ah_overflow_error_if(C) |
| Throws std::overflow_error if condition holds. | |
| #define | ah_overflow_error_unless(C) |
| Throws std::overflow_error if condition does NOT hold. | |
| #define | ah_overflow_error() |
| Throws std::overflow_error unconditionally. | |
| #define | ah_overflow_error_if_constexpr(C) |
| #define | ah_overflow_error_unless_constexpr(C) |
| #define | ah_domain_error_if(C) |
| Throws std::domain_error if condition holds. | |
| #define | ah_domain_error_unless(C) |
| Throws std::domain_error if condition does NOT hold. | |
| #define | ah_domain_error() |
| Throws std::domain_error unconditionally. | |
| #define | ah_domain_error_if_constexpr(C) |
| #define | ah_domain_error_unless_constexpr(C) |
| #define | ah_out_of_range_error_if(C) |
| Throws std::out_of_range if condition holds. | |
| #define | ah_out_of_range_error_unless(C) |
| Throws std::out_of_range if condition does NOT hold. | |
| #define | ah_out_of_range_error() |
| Throws std::out_of_range unconditionally. | |
| #define | ah_out_of_range_error_if_constexpr(C) |
| #define | ah_out_of_range_error_unless_constexpr(C) |
| #define | ah_invalid_argument_if(C) |
| Throws std::invalid_argument if condition holds. | |
| #define | ah_invalid_argument_unless(C) |
| Throws std::invalid_argument if condition does NOT hold. | |
| #define | ah_invalid_argument() |
| Throws std::invalid_argument unconditionally. | |
| #define | ah_invalid_argument_if_constexpr(C) |
| #define | ah_invalid_argument_unless_constexpr(C) |
| #define | ah_length_error_if(C) |
| Throws std::length_error if condition holds. | |
| #define | ah_length_error_unless(C) |
| Throws std::length_error if condition does NOT hold. | |
| #define | ah_length_error() |
| Throws std::length_error unconditionally. | |
| #define | ah_length_error_if_constexpr(C) |
| #define | ah_length_error_unless_constexpr(C) |
| #define | ah_fatal_error() |
| Throws an unconditional std::runtime_error (fatal error) | |
Exception handling system with formatted messages for Aleph-w.
This file provides a complete set of macros to throw standard C++ exceptions with custom messages and automatic code location tracking.
Definition in file ah-errors.H.
| #define ah_bad_alloc | ( | ) | do { [[unlikely]] throw std::bad_alloc(); } while (false) |
Throws std::bad_alloc unconditionally (no message stream)
Definition at line 421 of file ah-errors.H.
| #define ah_bad_alloc_if | ( | C | ) | do { if (C) [[unlikely]] throw std::bad_alloc(); } while (false) |
Throws std::bad_alloc if condition holds.
Definition at line 429 of file ah-errors.H.
| #define ah_bad_alloc_if_constexpr | ( | C | ) |
Definition at line 440 of file ah-errors.H.
| #define ah_bad_alloc_unless | ( | C | ) | do { if (!(C)) [[unlikely]] throw std::bad_alloc(); } while (false) |
Throws std::bad_alloc if condition does NOT hold.
Definition at line 437 of file ah-errors.H.
| #define ah_bad_alloc_unless_constexpr | ( | C | ) |
Definition at line 444 of file ah-errors.H.
| #define ah_domain_error | ( | ) |
Throws std::domain_error unconditionally.
| std::domain_error | always |
Throws a domain_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 554 of file ah-errors.H.
| #define ah_domain_error_if | ( | C | ) |
Throws std::domain_error if condition holds.
| C | Condition to evaluate |
| std::domain_error | if C is true |
Useful when a value is outside the valid domain of a function.
*
Definition at line 522 of file ah-errors.H.
| #define ah_domain_error_if_constexpr | ( | C | ) |
Definition at line 557 of file ah-errors.H.
| #define ah_domain_error_unless | ( | C | ) |
Throws std::domain_error if condition does NOT hold.
| C | Condition to evaluate |
| std::domain_error | if C is false |
Useful for validating that a value is in the valid domain.
*
Definition at line 538 of file ah-errors.H.
| #define ah_domain_error_unless_constexpr | ( | C | ) |
Definition at line 560 of file ah-errors.H.
| #define ah_fatal_error | ( | ) |
Throws an unconditional std::runtime_error (fatal error)
| std::runtime_error | always |
Useful for situations that should never occur or unrecoverable errors. Does not require a condition.
*
Definition at line 759 of file ah-errors.H.
| #define ah_invalid_argument | ( | ) |
Throws std::invalid_argument unconditionally.
| std::invalid_argument | always |
Throws an invalid_argument error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 671 of file ah-errors.H.
| #define ah_invalid_argument_if | ( | C | ) |
Throws std::invalid_argument if condition holds.
| C | Condition to evaluate |
| std::invalid_argument | if C is true |
Useful for validating function arguments. Most common exception for incorrect parameter validation.
*
Definition at line 639 of file ah-errors.H.
| #define ah_invalid_argument_if_constexpr | ( | C | ) |
Definition at line 675 of file ah-errors.H.
| #define ah_invalid_argument_unless | ( | C | ) |
Throws std::invalid_argument if condition does NOT hold.
| C | Condition to evaluate |
| std::invalid_argument | if C is false |
Useful for validating that arguments meet required conditions.
*
Definition at line 655 of file ah-errors.H.
| #define ah_invalid_argument_unless_constexpr | ( | C | ) |
Definition at line 679 of file ah-errors.H.
| #define ah_length_error | ( | ) |
Throws std::length_error unconditionally.
| std::length_error | always |
Throws a length_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 730 of file ah-errors.H.
| #define ah_length_error_if | ( | C | ) |
Throws std::length_error if condition holds.
| C | Condition to evaluate |
| std::length_error | if C is true |
Useful when an operation exceeds container size limits.
*
Definition at line 698 of file ah-errors.H.
| #define ah_length_error_if_constexpr | ( | C | ) |
Definition at line 734 of file ah-errors.H.
| #define ah_length_error_unless | ( | C | ) |
Throws std::length_error if condition does NOT hold.
| C | Condition to evaluate |
| std::length_error | if C is false |
Useful for validating that size is within allowed limits.
*
Definition at line 714 of file ah-errors.H.
| #define ah_length_error_unless_constexpr | ( | C | ) |
Definition at line 738 of file ah-errors.H.
| #define ah_logic_error | ( | ) |
Throws std::logic_error unconditionally.
| std::logic_error | always |
Throws a logic_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 341 of file ah-errors.H.
| #define ah_logic_error_if | ( | C | ) |
Throws std::logic_error if condition holds.
| C | Condition to evaluate |
| std::logic_error | if C is true |
Useful for detecting program logic errors.
*
Definition at line 325 of file ah-errors.H.
| #define ah_logic_error_if_constexpr | ( | C | ) |
Definition at line 345 of file ah-errors.H.
| #define ah_logic_error_unless | ( | C | ) |
Throws std::logic_error if condition does NOT hold.
| C | Condition to evaluate |
| std::logic_error | if C is false |
Useful for program logic errors (bugs, violated invariants).
*
Definition at line 309 of file ah-errors.H.
| #define ah_logic_error_unless_constexpr | ( | C | ) |
Definition at line 349 of file ah-errors.H.
| #define ah_out_of_range_error | ( | ) |
Throws std::out_of_range unconditionally.
| std::out_of_range | always |
Throws an out_of_range error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 611 of file ah-errors.H.
| #define ah_out_of_range_error_if | ( | C | ) |
Throws std::out_of_range if condition holds.
| C | Condition to evaluate |
| std::out_of_range | if C is true |
Useful for out of range element access in containers.
*
Definition at line 579 of file ah-errors.H.
| #define ah_out_of_range_error_if_constexpr | ( | C | ) |
Definition at line 615 of file ah-errors.H.
| #define ah_out_of_range_error_unless | ( | C | ) |
Throws std::out_of_range if condition does NOT hold.
| C | Condition to evaluate |
| std::out_of_range | if C is false |
Useful for validating valid index access.
*
Definition at line 595 of file ah-errors.H.
| #define ah_out_of_range_error_unless_constexpr | ( | C | ) |
Definition at line 619 of file ah-errors.H.
| #define ah_overflow_error | ( | ) |
Throws std::overflow_error unconditionally.
| std::overflow_error | always |
Throws an overflow_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 495 of file ah-errors.H.
| #define ah_overflow_error_if | ( | C | ) |
Throws std::overflow_error if condition holds.
| C | Condition to evaluate |
| std::overflow_error | if C is true |
Useful for arithmetic operations that result in overflow.
*
Definition at line 463 of file ah-errors.H.
| #define ah_overflow_error_if_constexpr | ( | C | ) |
Definition at line 499 of file ah-errors.H.
| #define ah_overflow_error_unless | ( | C | ) |
Throws std::overflow_error if condition does NOT hold.
| C | Condition to evaluate |
| std::overflow_error | if C is false |
Useful for validating absence of arithmetic overflow.
*
Definition at line 479 of file ah-errors.H.
| #define ah_overflow_error_unless_constexpr | ( | C | ) |
Definition at line 503 of file ah-errors.H.
| #define ah_range_error | ( | ) |
Throws std::range_error unconditionally.
| std::range_error | always |
Throws a range_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 223 of file ah-errors.H.
| #define ah_range_error_if | ( | C | ) |
Throws std::range_error if condition holds.
| C | Condition to evaluate |
| std::range_error | if C is true |
Useful for detecting values out of range.
*
Definition at line 207 of file ah-errors.H.
| #define ah_range_error_if_constexpr | ( | C | ) |
Definition at line 227 of file ah-errors.H.
| #define ah_range_error_unless | ( | C | ) |
Throws std::range_error if condition does NOT hold.
| C | Condition to evaluate |
| std::range_error | if C is false |
Useful for validating that a value is within a valid range. Error message includes location (file:line).
*
Definition at line 191 of file ah-errors.H.
| #define ah_range_error_unless_constexpr | ( | C | ) |
Definition at line 231 of file ah-errors.H.
| #define ah_runtime_error | ( | ) |
Throws std::runtime_error unconditionally.
| std::runtime_error | always |
Throws a runtime_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 282 of file ah-errors.H.
| #define ah_runtime_error_if | ( | C | ) |
Throws std::runtime_error if condition holds.
| C | Condition to evaluate |
| std::runtime_error | if C is true |
Useful for detecting runtime error conditions.
*
Definition at line 266 of file ah-errors.H.
| #define ah_runtime_error_if_constexpr | ( | C | ) |
Definition at line 286 of file ah-errors.H.
| #define ah_runtime_error_unless | ( | C | ) |
Throws std::runtime_error if condition does NOT hold.
| C | Condition to evaluate |
| std::runtime_error | if C is false |
Useful for errors only detected at runtime.
*
Definition at line 250 of file ah-errors.H.
| #define ah_runtime_error_unless_constexpr | ( | C | ) |
Definition at line 290 of file ah-errors.H.
| #define ah_underflow_error | ( | ) |
Throws std::underflow_error unconditionally.
| std::underflow_error | always |
Throws an underflow_error without evaluating any condition. Use when you need to throw directly.
*
Definition at line 400 of file ah-errors.H.
| #define ah_underflow_error_if | ( | C | ) |
Throws std::underflow_error if condition holds.
| C | Condition to evaluate |
| std::underflow_error | if C is true |
Useful for arithmetic operations that result in underflow.
*
Definition at line 368 of file ah-errors.H.
| #define ah_underflow_error_if_constexpr | ( | C | ) |
Definition at line 404 of file ah-errors.H.
| #define ah_underflow_error_unless | ( | C | ) |
Throws std::underflow_error if condition does NOT hold.
| C | Condition to evaluate |
| std::underflow_error | if C is false |
Useful for validating absence of arithmetic underflow.
*
Definition at line 384 of file ah-errors.H.
| #define ah_underflow_error_unless_constexpr | ( | C | ) |
Definition at line 408 of file ah-errors.H.
| #define ah_warning | ( | out | ) | (out) << "WARNING (" << __FILE__ << ":" << __LINE__ << ") | " |
Emits an unconditional warning to a stream.
| out | Output stream where to write the warning |
Writes a warning with file and line information without evaluating any condition.
*
Definition at line 172 of file ah-errors.H.
| #define ah_warning_if | ( | out, | |
| C | |||
| ) |
Emits a warning to a stream if the condition holds.
| out | Output stream where to write the warning |
| C | Condition to evaluate |
If condition C is true, writes a warning message with file and line information.
*
Definition at line 157 of file ah-errors.H.
| #define ah_warning_unless | ( | out, | |
| C | |||
| ) |
Emits a warning to a stream if the condition does NOT hold.
| out | Output stream where to write the warning |
| C | Condition to evaluate |
If condition C is false, writes a warning message with file and line information. Typical use with std::cerr.
*
Definition at line 141 of file ah-errors.H.