HDTree  0.5.2
HDTree C++ API
hdtree::HDTreeException Class Reference

user-facing exception class for hdtree More...

#include <Exception.h>

Inheritance diagram for hdtree::HDTreeException:
[legend]
Collaboration diagram for hdtree::HDTreeException:
[legend]

Public Member Functions

 HDTreeException (const std::string &msg, const std::string &help="") noexcept
 Create a new exception. More...
 
const char * what () const noexcept
 Override the message from the base class. More...
 
std::ostream & stream (std::ostream &o) const noexcept
 Stream the message of this exception into the input output stream. More...
 

Private Attributes

std::string message_
 the short message explaining the error
 
std::string help_
 an optional, longer message providing help for the situation
 

Detailed Description

user-facing exception class for hdtree

all of HDTree's C++ API exceptions are derived from this base exception and use the same API.

Constructor & Destructor Documentation

◆ HDTreeException()

hdtree::HDTreeException::HDTreeException ( const std::string &  msg,
const std::string &  help = "" 
)
noexcept

Create a new exception.

See also
stream for how the message and help will be formatted.
Parameters
[in]msgmessage of exception
[in]helpextra help information (optional)

Member Function Documentation

◆ stream()

std::ostream & hdtree::HDTreeException::stream ( std::ostream &  o) const
noexcept

Stream the message of this exception into the input output stream.

The output message looks like the following.

[HDTree]: <message>
Help: <help>

where the last line is only included if the help string is non-empty.

Parameters
[in]ooutput stream to write to
Returns
modified output stream

◆ what()

const char * hdtree::HDTreeException::what ( ) const
noexcept

Override the message from the base class.

Returns
C-style string with message

The documentation for this class was generated from the following files: