Fledge
An open source edge computing platform for industrial users
OMFError Class Reference

An encapsulation of an error return from an OMF call. More...

#include <omferror.h>

Public Member Functions

 OMFError ()
 Constructors.
 
 OMFError (const std::string &json)
 
 ~OMFError ()
 Destructor for the error class.
 
unsigned int messageCount ()
 
std::string getMessage (unsigned int offset)
 Return the error message for the given message. More...
 
std::string getEventReason (unsigned int offset)
 Return the error reason for the given message. More...
 
std::string getEventSeverity (unsigned int offset)
 Get the event severity for a given message. More...
 
std::string getEventExceptionType (unsigned int offset)
 Get the event exception type for a given message. More...
 
std::string getEventExceptionMessage (unsigned int offset)
 Get the event exception message for a given message. More...
 
int getHttpCode ()
 Return the most severe HTTP Code from all messages. More...
 
void setFromHttpResponse (const std::string &json)
 Parse error information from an OMF POST response JSON document. More...
 
bool hasErrors ()
 The error report contains at least one error level event.
 
bool hasMessages ()
 The error report contains at least one message.
 
bool Log (const std::string &mainMessage, bool filterDuplicates=true)
 Log all available messages. More...
 

Detailed Description

An encapsulation of an error return from an OMF call.

The class parses the JSON response and gives access to portion of that JSON response.

Member Function Documentation

◆ getEventExceptionMessage()

string OMFError::getEventExceptionMessage ( unsigned int  offset)

Get the event exception message for a given message.

Parameters
offsetThe message to examine
Returns
string The event exception message

◆ getEventExceptionType()

string OMFError::getEventExceptionType ( unsigned int  offset)

Get the event exception type for a given message.

Parameters
offsetThe message to examine
Returns
string The event exception type

◆ getEventReason()

string OMFError::getEventReason ( unsigned int  offset)

Return the error reason for the given message.

Parameters
offsetThe error within the report to return
Returns
string The event reason

◆ getEventSeverity()

string OMFError::getEventSeverity ( unsigned int  offset)

Get the event severity for a given message.

Parameters
offsetThe message to examine
Returns
string The event severity

◆ getHttpCode()

int OMFError::getHttpCode ( )

Return the most severe HTTP Code from all messages.

PI Web API HTTP Codes are usually the same within one HTTP response.

Returns
HTTP Code

◆ getMessage()

string OMFError::getMessage ( unsigned int  offset)

Return the error message for the given message.

Parameters
offsetThe error within the report to return
Returns
string The event message

◆ Log()

bool OMFError::Log ( const std::string &  mainMessage,
bool  filterDuplicates = true 
)

Log all available messages.

Parameters
mainMessageTop-level message when reporting an error
filterDuplicatesIf true, do not log duplicate messages
Returns
True if OMFError object holds at least one message

◆ setFromHttpResponse()

void OMFError::setFromHttpResponse ( const std::string &  json)

Parse error information from an OMF POST response JSON document.

Parameters
jsonJSON response document from an OMF POST

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