FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

full() method from fcf::Exception class

std::string full() const

Class: fcf::Exception

Package: fcfBasis

File: bits/PartException/ExceptionDecl.hpp ( link_to_the_declaration_in_the_file )

Implementation file: bits/PartException/Exception.hpp ( link_to_the_implementation_in_the_file )

Available from version: 1.0.1

Returns a comprehensive, hierarchical description of the exception and all its sub-exceptions.

The full method provides the most exhaustive error report available in the fcf::Exception class. It is designed for deep debugging scenarios where understanding the entire chain of causality is critical.

The output of full is highly detailed and includes:

  • Root Error: The primary error name, formatted message, and source position.
  • Sub-exception Tree: If the exception was created by wrapping other exceptions (sub-exceptions), full recursively traverses the entire hierarchy.
  • Hierarchical Indentation: Each level of the exception chain is visually indented, making the relationship between parent and child errors clear and easy to follow in log files.

Result
std::string
- A string containing the complete, hierarchical error report.

Example: Generating a full hierarchical error report

Demonstrating how to create an exception that wraps another exception and use the full method to display the entire error chain.

#include <iostream> #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { try { // 1. Create a base (sub) exception fcf::LogicException baseEx(__FILE__, __LINE__, "Base failure"); // 2. Create a top-level exception that wraps the base exception // The constructor for wrapping takes the sub-exception as the first argument throw fcf::LogicException(baseEx, __FILE__, __LINE__, "Higher-level error wrapping the base"); } catch (const fcf::Exception& e) { // 3. Retrieve and print the complete report // This will show both the primary exception and the wrapped base exception with indentation std::cout << e.full() << std::endl; } return 0; }

Output:

Error: FCF_LOGIC Message: Logic error: Higher-level error wrapping the base Position: /home/phoenix/Projects/fcfcpp/documentation/fcfBasis/fcf-Exception-function-full/main.cpp:12 Sub errors: 1] Error: FCF_LOGIC Message: Logic error: Base failure Position: /home/user/application/main.cpp:8

The full method is the ultimate tool for tracing error propagation through complex software layers.