libdigidocpp
digidoc::Exception Class Reference

#include <Exception.h>

Inheritance diagram for digidoc::Exception:
Inheritance graph
Collaboration diagram for digidoc::Exception:
Collaboration graph

Public Types

enum  ExceptionCode {
  CertificateIssuerMissing = 10, CertificateRevoked = 5, CertificateUnknown = 6, NoException = 0,
  OCSPResponderMissing = 8, OCSPCertMissing = 9, OCSPTimeSlot = 7, OCSPRequestUnauthorized = 11,
  PINCanceled = 2, PINFailed = 4, PINIncorrect = 1, PINLocked = 3
}
typedef std::vector< ExceptionCauses

Public Member Functions

 Exception (const std::string &file, int line, const std::string &msg)
 Exception (const std::string &file, int line, const std::string &msg, const Exception &cause)
ExceptionCode code () const
int ddoc () const
std::string getMsg () const
bool hasCause () const
Causes getCauses () const
void addCause (const Exception &cause)
void setCode (ExceptionCode Code)
void setDDoc (int err)

Protected Attributes

std::string file
std::string msg
int line
int m_ddoc
Causes causes
ExceptionCode m_code

Detailed Description

Base exception class of the digidoc implementation. Digidoc library should never throw exceptions other type than instance of this class or class inherited from this class like IOException or BDocException.

Author
Janari Põld

Definition at line 36 of file Exception.h.

Member Typedef Documentation

typedef std::vector<Exception> digidoc::Exception::Causes

Definition at line 56 of file Exception.h.

Member Enumeration Documentation

Exception code

Enumerator:
CertificateIssuerMissing 
CertificateRevoked 
CertificateUnknown 
NoException 
OCSPResponderMissing 
OCSPCertMissing 
OCSPTimeSlot 
OCSPRequestUnauthorized 
PINCanceled 
PINFailed 
PINIncorrect 
PINLocked 

Definition at line 42 of file Exception.h.

Constructor & Destructor Documentation

Exception::Exception ( const std::string &  file,
int  line,
const std::string &  msg 
)
Parameters
filefilename, where the exception was thrown.
lineline of the file, where the exception was thrown.
msgerror message.

Definition at line 31 of file Exception.cpp.

References DEBUG2, and line.

Exception::Exception ( const std::string &  file,
int  line,
const std::string &  msg,
const Exception cause 
)

Convenience constructor when there is just one cause for this Exception.

Parameters
filefilename, where the exception was thrown.
lineline of the file, where the exception was thrown.
msgerror message.
causecause of the exception.
See Also
hasCause()
getCause()

Definition at line 51 of file Exception.cpp.

References addCause(), DEBUG2, and line.

Here is the call graph for this function:

Member Function Documentation

void Exception::addCause ( const Exception cause)

Definition at line 77 of file Exception.cpp.

References causes.

Referenced by Exception(), and digidoc::SignatureBES::validateOffline().

Here is the caller graph for this function:

Exception::ExceptionCode Exception::code ( ) const
Returns
return exception code

Definition at line 65 of file Exception.cpp.

References m_code.

Referenced by setCode().

Here is the caller graph for this function:

int Exception::ddoc ( ) const
Returns
ddoc error code

Definition at line 70 of file Exception.cpp.

References m_ddoc.

Exception::Causes Exception::getCauses ( ) const

Returns exception causes (other exceptions that caused this exception).

Returns
returns exception causes if the exception has cause otherwise empty collection.
See Also
hasCause()

Definition at line 90 of file Exception.cpp.

References causes.

Referenced by getExceptionMsg(), and parseException().

Here is the caller graph for this function:

std::string Exception::getMsg ( ) const
Returns
returns error message.

Definition at line 75 of file Exception.cpp.

References msg.

Referenced by getExceptionMsg(), digidoc::DirectoryX509CertStore::loadCerts(), main(), parseException(), testOCSP(), testPKCS11Signer(), testRSASigner(), testSignBDoc(), testTMValidate(), testX509Verify(), and digidoc::XmlConf::XmlConf().

Here is the caller graph for this function:

bool Exception::hasCause ( ) const
Returns
returns whether the exception has cause.

Definition at line 82 of file Exception.cpp.

References causes.

Referenced by getExceptionMsg(), and digidoc::SignatureBES::validateOffline().

Here is the caller graph for this function:

void Exception::setCode ( ExceptionCode  code)
Parameters
codeset exception code

Definition at line 95 of file Exception.cpp.

References code(), and m_code.

Referenced by digidoc::EstEIDConsolePinSigner::getPin(), digidoc::SignatureTM::notarize(), digidoc::CNGSigner::sign(), digidoc::PKCS11Signer::sign(), digidoc::SignatureTM::validateOffline(), digidoc::SignatureBES::validateOnline(), and digidoc::OCSP::validateResponse().

Here is the call graph for this function:

Here is the caller graph for this function:

void Exception::setDDoc ( int  err)
Parameters
errset ddoc error code

Definition at line 100 of file Exception.cpp.

References m_ddoc.

Member Data Documentation

Causes digidoc::Exception::causes
protected

Definition at line 74 of file Exception.h.

Referenced by addCause(), getCauses(), and hasCause().

std::string digidoc::Exception::file
protected

Definition at line 70 of file Exception.h.

int digidoc::Exception::line
protected

Definition at line 72 of file Exception.h.

Referenced by Exception().

ExceptionCode digidoc::Exception::m_code
protected

Definition at line 75 of file Exception.h.

Referenced by code(), and setCode().

int digidoc::Exception::m_ddoc
protected

Definition at line 73 of file Exception.h.

Referenced by ddoc(), and setDDoc().

std::string digidoc::Exception::msg
protected

Definition at line 71 of file Exception.h.

Referenced by getMsg().


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