GEOS
Public Member Functions | Static Public Member Functions | List of all members
geos::DiagnosticMsgBuilder Class Reference

Builder class for constructing DiagnosticMsg objects. More...

#include <ErrorHandling.hpp>

Public Member Functions

DiagnosticMsgBuilderaddToMsg (std::exception const &e, bool toEnd=false)
 Append exception text to the message. More...
 
DiagnosticMsgBuilderaddToMsg (std::string_view msg, bool toEnd=false)
 Append text to the message. More...
 
template<typename ... Args>
DiagnosticMsgBuilderaddContextInfo (Args &&... args)
 Adds one or more context elements to the error. More...
 
DiagnosticMsgBuilderaddDetectionLocation (string_view detectionLocation)
 Add where the detection occured. More...
 
DiagnosticMsgBuilderaddSignal (integer sig, bool toEnd=false)
 Add the signal to the DiagnosticMsg. More...
 
DiagnosticMsgBuildersetCodeLocation (std::string_view msgFile, integer msgLine)
 Set the source code location values (file and line where the error is detected) More...
 
DiagnosticMsgBuildersetType (MsgType msgType)
 Set the type of the error, (amoung one of the MsgType) More...
 
DiagnosticMsgBuildersetCause (std::string_view cause)
 Set the cause of the error. More...
 
DiagnosticMsgBuilderaddRank (integer rank)
 Add a rank on which the error has been raised. More...
 
DiagnosticMsgBuilderaddCallStackInfo (std::string_view stacktrace)
 Add the stack trace information about the error. More...
 
DiagnosticMsggetDiagnosticMsg ()
 

Static Public Member Functions

static DiagnosticMsgBuilder init (DiagnosticMsg &msg, MsgType msgType, std::string_view msgContent, integer rank)
 Initialize a new DiagnosticMsg. More...
 
static DiagnosticMsgBuilder modify (DiagnosticMsg &errorMsg)
 Modify an existing DiagnosticMsg. More...
 

Detailed Description

Builder class for constructing DiagnosticMsg objects.

Definition at line 151 of file ErrorHandling.hpp.

Member Function Documentation

◆ addCallStackInfo()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addCallStackInfo ( std::string_view  stacktrace)

Add the stack trace information about the error.

Parameters
stacktracestack trace information to add
Returns
Reference to the current instance for method chaining.

◆ addContextInfo()

template<typename ... Args>
DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addContextInfo ( Args &&...  args)
inline

Adds one or more context elements to the error.

Template Parameters
ArgsVariadic pack of compatible types (ErrorContext / DataContext)
Parameters
argsList of context data structures.
Returns
Reference to the current instance for method chaining.

Definition at line 198 of file ErrorHandling.hpp.

◆ addDetectionLocation()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addDetectionLocation ( string_view  detectionLocation)

Add where the detection occured.

Parameters
detectionLocationThe context where the diagnostic happoned
Returns
The instance, for builder pattern.

◆ addRank()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addRank ( integer  rank)

Add a rank on which the error has been raised.

Parameters
rankThe rank value
Returns
Reference to the current instance for method chaining.

◆ addSignal()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addSignal ( integer  sig,
bool  toEnd = false 
)

Add the signal to the DiagnosticMsg.

  • the signal can be one of the main error signals.
  • if the signal is SIGFPE, the nature of floating point error will be interpreted.
    Parameters
    sigThe signal, from ISO C99 or POSIX standard.
    toEndadds the message to the end if true, at the start otherwise.
    Returns
    The instance, for builder pattern.

◆ addToMsg() [1/2]

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addToMsg ( std::exception const &  e,
bool  toEnd = false 
)

Append exception text to the message.

Parameters
eThe exception containing text to add
toEndIf true, append at end; otherwise prepend
Returns
Reference to the current instance for method chaining.

◆ addToMsg() [2/2]

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::addToMsg ( std::string_view  msg,
bool  toEnd = false 
)

Append text to the message.

Parameters
msgThe text to add
toEndIf true, append at end; otherwise prepend
Returns
Reference to the current instance for method chaining.

◆ getDiagnosticMsg()

DiagnosticMsg& geos::DiagnosticMsgBuilder::getDiagnosticMsg ( )
Returns
Get the DiagnosticMsg

◆ init()

static DiagnosticMsgBuilder geos::DiagnosticMsgBuilder::init ( DiagnosticMsg msg,
MsgType  msgType,
std::string_view  msgContent,
integer  rank 
)
static

Initialize a new DiagnosticMsg.

Parameters
msgThe DiagnosticMsg being built
msgTypeType of the diagnostic
msgContentThe message of the diagnostic. It can be completed afterward
rankThe rank on which the diagnostic occured
Returns
DiagnosticMsgBuilder

◆ modify()

static DiagnosticMsgBuilder geos::DiagnosticMsgBuilder::modify ( DiagnosticMsg errorMsg)
static

Modify an existing DiagnosticMsg.

Parameters
errorMsgThe existing DiagnosticMsg
Returns
DiagnosticMsgBuilder

◆ setCause()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::setCause ( std::string_view  cause)

Set the cause of the error.

Parameters
causeSee documentation of m_cause.
Returns
Reference to the current instance for method chaining.

◆ setCodeLocation()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::setCodeLocation ( std::string_view  msgFile,
integer  msgLine 
)

Set the source code location values (file and line where the error is detected)

Parameters
msgFileName of the source file location to add
msgLineLine of the source file location to add
Returns
Reference to the current instance for method chaining.

◆ setType()

DiagnosticMsgBuilder& geos::DiagnosticMsgBuilder::setType ( MsgType  msgType)

Set the type of the error, (amoung one of the MsgType)

Parameters
msgTypeThe type can be error, warning or exception
Returns
Reference to the current instance for method chaining.

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