Nameless Engine
Loading...
Searching...
No Matches
ne::Error Class Reference

#include <Error.h>

Public Member Functions

 Error (std::string_view sMessage, const std::source_location location=std::source_location::current())
 
 Error (const Error &other)=default
 
Erroroperator= (const Error &other)=default
 
 Error (Error &&other)=default
 
Erroroperator= (Error &&other)=default
 
void addCurrentLocationToErrorStack (const std::source_location location=std::source_location::current())
 
std::string getFullErrorMessage () const
 
std::string getInitialMessage () const
 
void showError () const
 

Static Protected Member Functions

static SourceLocationInfo sourceLocationToInfo (const std::source_location &location)
 

Private Attributes

std::string sMessage
 
std::vector< SourceLocationInfostack
 

Detailed Description

Helper class for storing and showing error messages.

Constructor & Destructor Documentation

◆ Error() [1/3]

ne::Error::Error ( std::string_view  sMessage,
const std::source_location  location = std::source_location::current() 
)

Constructs a new Error object.

Parameters
sMessageError message to show.
locationShould not be specified explicitly (use default value).

◆ Error() [2/3]

ne::Error::Error ( const Error other)
default

Copy constructor.

Parameters
otherother object.

◆ Error() [3/3]

ne::Error::Error ( Error &&  other)
default

Move constructor.

Parameters
otherother object.

Member Function Documentation

◆ addCurrentLocationToErrorStack()

void ne::Error::addCurrentLocationToErrorStack ( const std::source_location  location = std::source_location::current())

Adds the caller's file and line as a new entry to the error location stack.

Parameters
locationShould not be specified explicitly (use default value).

◆ getFullErrorMessage()

std::string ne::Error::getFullErrorMessage ( ) const

Creates an error string that contains an error message and an error location stack.

Returns
Error message and error stack.

◆ getInitialMessage()

std::string ne::Error::getInitialMessage ( ) const

Returns initial error message that was used to create this error.

Returns
Initial error message.

◆ operator=() [1/2]

Error & ne::Error::operator= ( const Error other)
default

Copy assignment.

Parameters
otherother object.
Returns
Result of copy assignment.

◆ operator=() [2/2]

Error & ne::Error::operator= ( Error &&  other)
default

Move assignment.

Parameters
otherother object.
Returns
Result of move assignment.

◆ showError()

void ne::Error::showError ( ) const

Creates an error string, shows it on screen and also writes it to log.

◆ sourceLocationToInfo()

SourceLocationInfo ne::Error::sourceLocationToInfo ( const std::source_location &  location)
staticprotected

Converts source_location instance to location information.

Parameters
locationSource location instance.
Returns
Location information.

Member Data Documentation

◆ sMessage

std::string ne::Error::sMessage
private

Initial error message (string version).

◆ stack

std::vector<SourceLocationInfo> ne::Error::stack
private

Error stack.


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