JAULA::Exception Class Reference
[JAULA: Error handling]

Base class for error handling exceptions. More...

#include <jaula_exception.h>

Inheritance diagram for JAULA::Exception:

Inheritance graph
[legend]
Collaboration diagram for JAULA::Exception:

Collaboration graph
[legend]

Public Types

enum  ExCode {
  NO_ERROR, BAD_DATA_TYPE, NAME_DUPLICATED, LEXAN_ERROR,
  SYNTAX_ERROR
}
 Enumeration of available error codes. More...

Public Member Functions

void addOrigin (std::string const &origin)
 Attachs a new origin after the existing ones.
void display (std::ostream &ostr) const
 Represents the instance in a stream.
 Exception (Exception const &orig)
 Copy constructor.
 Exception (ExCode code=NO_ERROR, std::string const &detail="", std::string const &action="", std::string const &origin="")
 Constructor.
std::string const & getAction (void) const
 Retrieves the action that caused the exception.
ExCode getCode (void) const
 Retrieves the error code for the exception.
virtual std::string const & getDetail (void) const
 Retrieves the detailed description for the exception.
std::string const & getOrigin (void) const
 Retrieves the method being run when the exception arose.
Exceptionoperator= (Exception const &orig)
 Assignment operator.
void setAction (std::string const &action)
 Establishes the action that caused the exception.
void setDetail (std::string const &detail)
 Establishes the description for the exception.
void setOrigin (std::string const &origin)
 Establishes the method being run when the exception arose.
virtual ~Exception ()
 Destructor.

Protected Member Functions

void setCode (ExCode code)
 Establishes the error code for the exception.

Private Attributes

std::string action_
 Container action causing the exception.
ExCode code_
 Container for error code.
std::string detail_
 Container for exception textual detail.
std::string origin_
 Container for where the exception was detected.

Detailed Description

Base class for error handling exceptions.

This class is the base for all kind of exceptions thrown by the methods defined in this library.
Author:
Kombo Morongo <morongo666@gmail.com>


Member Enumeration Documentation

enum JAULA::Exception::ExCode

Enumeration of available error codes.

Enumerator:
NO_ERROR  No Error detected
BAD_DATA_TYPE  The data provided for a method is from a wrong type
NAME_DUPLICATED  Name repeated for an object property
LEXAN_ERROR  Error detected in the lexical Analysis phase
SYNTAX_ERROR  Error detected in the syntaxis Analysis phase


Constructor & Destructor Documentation

JAULA::Exception::Exception ( ExCode  code = NO_ERROR,
std::string const &  detail = "",
std::string const &  action = "",
std::string const &  origin = "" 
)

Constructor.

Parameters:
code Code for the exception as defined in ExCode
detail detailed description about the exception (what made the execution fail).
action action being performed when the exception arose.
origin Name of the method (and others methods that have called this) by the time the exception arose.
Description
This method construct a new exception instance detailing each available property.

JAULA::Exception::Exception ( Exception const &  orig  ) 

Copy constructor.

Parameters:
orig Original instance to copy
Description
Creates a new instance copying the contents from another

JAULA::Exception::~Exception (  )  [virtual]

Destructor.


Member Function Documentation

void JAULA::Exception::addOrigin ( std::string const &  origin  ) 

Attachs a new origin after the existing ones.

Parameters:
origin Name of the method to add
Description
Adds the name of a method who is supposed to be the next method in the calling stack from where the exception occured so a basic trace can be performed.

void JAULA::Exception::display ( std::ostream &  ostr  )  const

Represents the instance in a stream.

Parameters:
ostr Stream where the instance is to be displayed.
Description
Puts a text representation of the instance contents in a stream.

std::string const & JAULA::Exception::getAction ( void   )  const

Retrieves the action that caused the exception.

Exception::ExCode JAULA::Exception::getCode ( void   )  const

Retrieves the error code for the exception.

std::string const & JAULA::Exception::getDetail ( void   )  const [virtual]

Retrieves the detailed description for the exception.

Note:
This method has been declared as virtual so it can be overrwritten to generate automatic detailed descriptions for specific (derived) exception types.

Reimplemented in JAULA::Name_Duplicated.

std::string const & JAULA::Exception::getOrigin ( void   )  const

Retrieves the method being run when the exception arose.

Description
Retrieves the method being run when the exception arose and the methods that called it if available.

Exception & JAULA::Exception::operator= ( Exception const &  orig  ) 

Assignment operator.

Parameters:
orig Original instance to copy
Returns:
a reference to the destination instance
Description
Copies the contents of the original instance in the destination.
Note:
This method controls if destination and origin instances are the same so there is no trouble in a = a asignments.

void JAULA::Exception::setAction ( std::string const &  action  ) 

Establishes the action that caused the exception.

Parameters:
action action being performed when the exception arose.

void JAULA::Exception::setCode ( ExCode  code  )  [protected]

Establishes the error code for the exception.

Parameters:
code Code for the exception as defined in ExCode

void JAULA::Exception::setDetail ( std::string const &  detail  ) 

Establishes the description for the exception.

Parameters:
detail detailed description about the exception (what made the execution fail).

void JAULA::Exception::setOrigin ( std::string const &  origin  ) 

Establishes the method being run when the exception arose.

Parameters:
origin Name of the method (and others methods that have called this) by the time the exception arose.


Field Documentation

std::string JAULA::Exception::action_ [private]

Container action causing the exception.

ExCode JAULA::Exception::code_ [private]

Container for error code.

std::string JAULA::Exception::detail_ [private]

Container for exception textual detail.

Reimplemented in JAULA::Name_Duplicated.

std::string JAULA::Exception::origin_ [private]

Container for where the exception was detected.


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


Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.


Copyright (c) 2007 Kombo Morongo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

API Reference Generated for jaula by

doxygen

jaula project hosted by

SourceForge.net Logo