Warning, /acts/docs/groups/errors.md is written in an unsupported language. File is not indexed.
0001 @defgroup errors Error definitions
0002
0003 # Error Handling in ACTS
0004
0005 ACTS uses `std::error_code` from the C++ Standard Library for type-safe,
0006 extensible error handling. This approach allows error codes to be returned from
0007 functions without throwing exceptions, while maintaining compatibility with the
0008 standard error handling mechanisms. Error codes are typically used with the
0009 @ref Acts::Result type for ergonomic error propagation.
0010
0011 ## std::error_code Overview
0012
0013 `std::error_code` is a platform-dependent error code that consists of:
0014
0015 - An integer error value
0016 - A reference to an error category (error domain)
0017
0018 Various ACTS components define their own strongly-typed error enum class and
0019 register it with the standard library's error code system using
0020 `std::is_error_code_enum` specialization. This allows seamless conversion to
0021 `std::error_code` while preserving type safety.
0022
0023 ## Error Enum Pattern
0024
0025 All ACTS error enums follow a consistent pattern:
0026
0027 @snippet{trimleft} examples/errors.cpp Error Enum Pattern
0028
0029 The enums are registered with STL by specializing `std::is_error_code_enum<T>`
0030 to enable implicit conversion to `std::error_code`.
0031
0032 ## Usage with Result Type
0033
0034 Error codes are typically used with the @ref Acts::Result type, which
0035 encapsulates either a successful result or an error:
0036
0037 @snippet{trimleft} examples/errors.cpp Usage with Result Type
0038
0039 The @ref Acts::Result type defaults to using `std::error_code` as its error
0040 type, making it compatible with all ACTS error enums.
0041
0042 ## Benefits
0043
0044 - **Type Safety**: Each component has its own error enum preventing confusion
0045 between different error domains
0046 - **No Exceptions**: Errors are returned as values, enabling explicit error
0047 handling without exception overhead
0048 - **Standard Compatibility**: Integration with `std::error_code` allows use
0049 with standard library error handling facilities
0050 - **Extensibility**: New error types can be added to any enum without breaking
0051 binary compatibility