PreEmptive Analytics Linux Client
 All Classes Files Functions Variables Typedefs Macros
Public Member Functions | Static Public Attributes | List of all members
ExceptionInfo Class Reference

Describes an exception. More...

Public Member Functions

DLL_PACLIENT ExceptionInfo ()
 Create an empty ExceptionInfo instance. More...
 
DLL_PACLIENT ~ExceptionInfo ()
 Dispose of a ExceptionInfo instance. More...
 
DLL_PACLIENT ExceptionInfoCaught ()
 The exception being described was caught by the application. More...
 
DLL_PACLIENT ExceptionInfoCaught (const std::exception &exception)
 Populate the instance using the provided caught exception. More...
 
DLL_PACLIENT ExceptionInfoComment (const wchar_t *comment)
 Set the user provided comment. More...
 
DLL_PACLIENT ExceptionInfoContact (const wchar_t *contact)
 Set the user contact information. More...
 
DLL_PACLIENT int GetEventType () const
 Get the event type. More...
 
DLL_PACLIENT const wchar_t * GetEventTypeString () const
 Get the even type as a string. More...
 
DLL_PACLIENT const wchar_t * GetMessage () const
 Get the message associated with the exception. More...
 
DLL_PACLIENT const wchar_t * GetType () const
 Get the type or class of the exception being described. More...
 
DLL_PACLIENT const wchar_t * GetUserComment () const
 Get the user provided comment. More...
 
DLL_PACLIENT const wchar_t * GetUserContact () const
 Get the user contact information. More...
 
DLL_PACLIENT ExceptionInfoMessage (const wchar_t *message)
 Set the message associated with the exception. More...
 
DLL_PACLIENT ExceptionInfooperator= (const ExceptionInfo *other)
 Assign the values of another instance to this instance. More...
 
DLL_PACLIENT void SetEventType (int eventType)
 Set the event type of the exception being described. More...
 
DLL_PACLIENT void SetMessage (const wchar_t *message)
 Set the message associated with the exception. More...
 
DLL_PACLIENT void SetType (const wchar_t *type)
 Set the type or class of the exception being described. More...
 
DLL_PACLIENT void SetUserComment (const wchar_t *comment)
 Set the user provided comment. More...
 
DLL_PACLIENT void SetUserContact (const wchar_t *contact)
 Set the user contact information. More...
 
DLL_PACLIENT ExceptionInfoThrown ()
 The exception being described is about to be thrown by the application. More...
 
DLL_PACLIENT ExceptionInfoThrown (const std::exception &exception)
 Propulate the instance using the provided exception that is about to be thrown. More...
 
DLL_PACLIENT ExceptionInfoType (const wchar_t *type)
 Set the type or class of the exception being described. More...
 
DLL_PACLIENT ExceptionInfoUncaught ()
 The exception being described was not handled by the application. This is typically used for exceptions received at a global level. More...
 
DLL_PACLIENT ExceptionInfoUncaught (const std::exception &exception)
 Populate the instance using the provided unhandled exception. More...
 

Static Public Attributes

static DLL_PACLIENT const int EVENT_CAUGHT
 The exception being described was caught by the application. More...
 
static DLL_PACLIENT const int EVENT_THROWN
 The exception being described is about to be thrown by the application. More...
 
static DLL_PACLIENT const int EVENT_UNCAUGHT
 The exception being described was not handled by the application. This is typically used for exceptions received at a global level. More...
 

Detailed Description

Describes an exception.

A ExceptionInfo is used to describe an exception even in an application as well as user provided infomation.
All values are optional.
Instances can be created using setters:

ExceptionInfo exp;
exp.SetMessage("A bad thing happened");
exp.SetUserComment(GetComments());
exp.SetUserContact(GetEmailAddress());
PAClient::ReportException(exp);
They can also be created using method chaining:

ExceptionInfo exp;
exp.Message("A bad thing happened").Comment(GetComments()).Contact(GetEmailAddress());
PAClient::ReportException(exp);
And they can be created using std::exception :

catch(std::exception& e)
{
    ExceptionInfo exp;
    PAClient::ReportException(exp.Caught(e));
}

Constructor & Destructor Documentation

DLL_PACLIENT ExceptionInfo::ExceptionInfo ( )

Create an empty ExceptionInfo instance.

Creates a new instance will default values. All strings are blank and numeric values are zero. The default event type is EVENT_CAUGHT
DLL_PACLIENT ExceptionInfo::~ExceptionInfo ( )

Dispose of a ExceptionInfo instance.

Deletes the prevously created instance.

Member Function Documentation

DLL_PACLIENT ExceptionInfo& ExceptionInfo::Caught ( )

The exception being described was caught by the application.

Returns
this instance
See Also
SetEventType()
EVENT_CAUGHT
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Caught ( const std::exception &  exception)

Populate the instance using the provided caught exception.

Parameters
exceptionthe exception was caught
Returns
this instance
See Also
SetEventType()
SetMessage()
EVENT_CAUGHT
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Comment ( const wchar_t *  comment)

Set the user provided comment.

This may be used to collect information from the user to relate the circumstances surrounding the exception. The size of the comment is limited to 500 characters.
Parameters
commentthe user provide comment
See Also
SetUserComment()
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Contact ( const wchar_t *  contact)

Set the user contact information.

This may be used to collect contact information for follow up to the reported exception. The size of the contact information is limited to 500 characters.
Parameters
contactuser provided contact information such as a customer name, email, phone number, etc.
Returns
this instance
See Also
SetUserContact()
DLL_PACLIENT int ExceptionInfo::GetEventType ( ) const

Get the event type.

Returns
one of the event types
See Also
EVENT_CAUGHT
EVENT_UNCAUGHT
EVENT_THROWN
DLL_PACLIENT const wchar_t* ExceptionInfo::GetEventTypeString ( ) const

Get the even type as a string.

Returns
the type as a string: caught; uncaught; thrown
DLL_PACLIENT const wchar_t* ExceptionInfo::GetMessage ( ) const

Get the message associated with the exception.

DLL_PACLIENT const wchar_t* ExceptionInfo::GetType ( ) const

Get the type or class of the exception being described.

Returns
the type or class of the exception
DLL_PACLIENT const wchar_t* ExceptionInfo::GetUserComment ( ) const

Get the user provided comment.

Returns
the previously set user provided comment.
DLL_PACLIENT const wchar_t* ExceptionInfo::GetUserContact ( ) const

Get the user contact information.

Returns
the previously set contact information
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Message ( const wchar_t *  message)

Set the message associated with the exception.

Parameters
messagethe message string associated with the exception.
Returns
this instance
See Also
SetMessage()
DLL_PACLIENT ExceptionInfo& ExceptionInfo::operator= ( const ExceptionInfo other)

Assign the values of another instance to this instance.

Parameters
otherthe instance whos values are being assigned to this instance. If null then this instance is defaulted to its original state.
Returns
this instance.
DLL_PACLIENT void ExceptionInfo::SetEventType ( int  eventType)

Set the event type of the exception being described.

This describes the circumstances of the exceptional event.
Parameters
eventTypethe type of the event
See Also
EVENT_CAUGHT
EVENT_UNCAUGHT
EVENT_THROWN
DLL_PACLIENT void ExceptionInfo::SetMessage ( const wchar_t *  message)

Set the message associated with the exception.

Typically the output of exception::what()
Parameters
messagethe message string associated with the exception.
DLL_PACLIENT void ExceptionInfo::SetType ( const wchar_t *  type)

Set the type or class of the exception being described.

Parameters
typetypically the name of the exception class
DLL_PACLIENT void ExceptionInfo::SetUserComment ( const wchar_t *  comment)

Set the user provided comment.

This may be used to collect information from the user to relate the circumstances surrounding the exception. The size of the comment is limited to 500 characters.
Parameters
commentthe user provide comment
DLL_PACLIENT void ExceptionInfo::SetUserContact ( const wchar_t *  contact)

Set the user contact information.

This may be used to collect contact information for follow up to the reported exception. The size of the contact information is limited to 500 characters.
Parameters
contactuser provided contact information such as a customer name, email, phone number, etc.
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Thrown ( )

The exception being described is about to be thrown by the application.

Returns
this instance
See Also
SetEventType()
EVENT_THROWN
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Thrown ( const std::exception &  exception)

Propulate the instance using the provided exception that is about to be thrown.

Parameters
exceptionthe exception being thrown
Returns
this instance
See Also
SetEventType()
SetMessage()
EVENT_THROWN
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Type ( const wchar_t *  type)

Set the type or class of the exception being described.

Parameters
typetypically the name of the exception class
Returns
this instance
See Also
SetType()
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Uncaught ( )

The exception being described was not handled by the application. This is typically used for exceptions received at a global level.

Returns
this instance
See Also
SetEventType()
EVENT_UNCAUGHT
DLL_PACLIENT ExceptionInfo& ExceptionInfo::Uncaught ( const std::exception &  exception)

Populate the instance using the provided unhandled exception.

Parameters
exceptionthe exception that was not handled
Returns
this instance
See Also
SetEventType()
SetMessage()
EVENT_UNCAUGHT

Member Data Documentation

DLL_PACLIENT const int ExceptionInfo::EVENT_CAUGHT
static

The exception being described was caught by the application.

See Also
SetEventType(int)
DLL_PACLIENT const int ExceptionInfo::EVENT_THROWN
static

The exception being described is about to be thrown by the application.

See Also
SetEventType(int)
DLL_PACLIENT const int ExceptionInfo::EVENT_UNCAUGHT
static

The exception being described was not handled by the application. This is typically used for exceptions received at a global level.

See Also
SetEventType(int)