Freundlich's C++ toolkit
Public Member Functions | Public Attributes
fcppt::exception Class Reference

Detailed Description

The base class for all exceptions.

fcppt::exception is a wrapper around an exception that uses fcppt::string to store the error message. Note that you will have to use fcppt::exception::string to obtain the string. If you use what(), which is only provided for compatibility with std::exception, nothing useful will be returned. The reason behind this is that a string conversion itself can result in exceptions being thrown. That is why what() does not try to convert from fcppt::string to std::string.

Inheritance diagram for fcppt::exception:
fcppt::assert_::exception fcppt::cast::bad_dynamic fcppt::cast::bad_truncation_check fcppt::options::exception fcppt::time::exception fcppt::variant::exception fcppt::options::duplicate_names fcppt::variant::invalid_get

Public Member Functions

FCPPT_DETAIL_SYMBOL exception (fcppt::string &&what)
 Constructs an exception from a string. More...
FCPPT_DETAIL_SYMBOL exception (exception const &)
FCPPT_DETAIL_SYMBOL exception (exception &&)
fcppt::string const & string () const
 Returns the error message. More...
FCPPT_DETAIL_SYMBOL char const * what () const noexcept override
 Returns a generic error. More...
FCPPT_DETAIL_SYMBOL ~exception () noexcept override

Public Attributes

FCPPT_DETAIL_SYMBOL exception operator

Constructor & Destructor Documentation

◆ exception() [1/3]

FCPPT_DETAIL_SYMBOL fcppt::exception::exception ( fcppt::string &&  what)

Constructs an exception from a string.

◆ exception() [2/3]

FCPPT_DETAIL_SYMBOL fcppt::exception::exception ( exception const &  )

◆ exception() [3/3]

FCPPT_DETAIL_SYMBOL fcppt::exception::exception ( exception &&  )

◆ ~exception()

FCPPT_DETAIL_SYMBOL fcppt::exception::~exception ( )

Member Function Documentation

◆ string()

fcppt::string const& fcppt::exception::string ( ) const

Returns the error message.

Use this function to print the error message instead of what()

◆ what()

FCPPT_DETAIL_SYMBOL char const* fcppt::exception::what ( ) const

Returns a generic error.

This function's purpose is to provide compatibility with std::exception. It returns nothing useful.

Member Data Documentation

◆ operator

FCPPT_DETAIL_SYMBOL exception fcppt::exception::operator
Initial value:
exception const &