MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MaCh3Exception Class Reference

Custom exception class for MaCh3 errors. More...

#include <Manager/MaCh3Exception.h>

Inheritance diagram for MaCh3Exception:
[legend]
Collaboration diagram for MaCh3Exception:
[legend]

Public Member Functions

 MaCh3Exception (std::string File, int Line, std::string Message="")
 Constructs a MaCh3Exception object with the specified error message.
 
const char * what () const noexcept override
 Returns the error message associated with this exception.
 

Private Attributes

std::string errorMessage
 The error message associated with this exception.
 

Detailed Description

Custom exception class for MaCh3 errors.

Definition at line 13 of file MaCh3Exception.h.

Constructor & Destructor Documentation

◆ MaCh3Exception()

MaCh3Exception::MaCh3Exception ( std::string  File,
int  Line,
std::string  Message = "" 
)
inlineexplicit

Constructs a MaCh3Exception object with the specified error message.

Parameters
FileThe name of the file where the exception occurred.
LineThe line number where the exception occurred.
MessageThe error message describing the exception (optional).

Definition at line 19 of file MaCh3Exception.h.

20 {
21 size_t lastSlashPos = File.find_last_of('/');
22 std::string fileName = (lastSlashPos != std::string::npos) ? File.substr(lastSlashPos + 1) : File;
23
24 errorMessage = ((Message.empty()) ? "Terminating MaCh3" : Message);
25 // KS: Set logger format where we only have have "information type", line would be confusing
26 spdlog::set_pattern("[%^%l%$] %v");
27 MACH3LOG_ERROR("Find me here: {}::{}", fileName, Line);
28 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:25
std::string errorMessage
The error message associated with this exception.

Member Function Documentation

◆ what()

const char * MaCh3Exception::what ( ) const
inlineoverridenoexcept

Returns the error message associated with this exception.

Returns
A pointer to the error message string.

Definition at line 32 of file MaCh3Exception.h.

32 {
33 return errorMessage.c_str();
34 }

Member Data Documentation

◆ errorMessage

std::string MaCh3Exception::errorMessage
private

The error message associated with this exception.

Definition at line 38 of file MaCh3Exception.h.


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