FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::Exception Class Reference

#include <exception.hpp>

Inheritance diagram for fcn::Exception:

Public Member Functions

 Exception (std::string message, std::source_location location=std::source_location::current())
std::string const & getFilename () const
std::string const & getFunction () const
unsigned int getLine () const
std::string const & getMessage () const
char const * what () const noexcept override

Detailed Description

An exception class containing a message, a file, and a line number where the exception occurred.

This class is used to throw exceptions in the GUI code with detailed information about the source location. The exception will contain the filename, line number, and function name where the exception was thrown. This makes it easier to identify the source of the exception.

The exception is thrown using the fcn::throwException function, which automatically captures the source location (filename, line number, and function name).

EXAMPLE:

throwException("my error message");

This is a header only class and so its not exported via FIFEGUI_API.

Definition at line 35 of file exception.hpp.

Constructor & Destructor Documentation

◆ Exception()

fcn::Exception::Exception ( std::string message,
std::source_location location = std::source_location::current() )
inlineexplicit

Constructor that takes a message and source location.

Parameters
messageThe error message of the exception.
locationThe source location of where the exception occurred.

Definition at line 44 of file exception.hpp.

Member Function Documentation

◆ getFilename()

std::string const & fcn::Exception::getFilename ( ) const
inline

Gets the filename where the exception occurred.

Returns
The filename where the exception occurred.

Definition at line 88 of file exception.hpp.

◆ getFunction()

std::string const & fcn::Exception::getFunction ( ) const
inline

Gets the function name where the exception occurred.

Returns
The function name where the exception occurred.

Definition at line 68 of file exception.hpp.

◆ getLine()

unsigned int fcn::Exception::getLine ( ) const
inline

Gets the line number where the exception occurred.

Returns
The line number where the exception occurred.

Definition at line 98 of file exception.hpp.

◆ getMessage()

std::string const & fcn::Exception::getMessage ( ) const
inline

Gets the message of the exception.

Returns
The message of the exception.

Definition at line 78 of file exception.hpp.

◆ what()

char const * fcn::Exception::what ( ) const
inlineoverridenoexcept

Returns a pointer to a null-terminated string with a description of the exception.

Returns
const char* A pointer to a null-terminated string with a description of the exception.

Definition at line 58 of file exception.hpp.


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