4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
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::enum_::invalid< Enum > fcppt::options::exception fcppt::options::duplicate_names

Public Member Functions

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

Constructor & Destructor Documentation

◆ exception() [1/3]

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

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 && )
noexcept

◆ ~exception()

FCPPT_DETAIL_SYMBOL fcppt::exception::~exception ( )
overridenoexcept

Member Function Documentation

◆ operator=() [1/2]

FCPPT_DETAIL_SYMBOL exception & fcppt::exception::operator= ( exception && )
noexcept

◆ operator=() [2/2]

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

◆ string()

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

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
nodiscardoverridenoexcept

Returns a generic error.

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