libdigidocpp 4.1.0
digidoc::Exception Class Reference

Base exception class of the digidoc implementation. More...

#include <Exception.h>

Public Types

enum  ExceptionCode {
  General = 0 , NetworkError = 20 , HostNotFound = 101 , InvalidUrl = 102 ,
  CertificateIssuerMissing = 10 , CertificateRevoked = 5 , CertificateUnknown = 6 , OCSPBeforeTimeStamp = 19 ,
  OCSPResponderMissing = 8 , OCSPCertMissing = 9 , OCSPTimeSlot = 7 , OCSPRequestUnauthorized = 11 ,
  TSForbidden = 21 , TSTooManyRequests = 18 , PINCanceled = 2 , PINFailed = 4 ,
  PINIncorrect = 1 , PINLocked = 3 , ReferenceDigestWeak = 12 , SignatureDigestWeak = 13 ,
  DataFileNameSpaceWarning = 14 , IssuerNameSpaceWarning = 15 , ProducedATLateWarning = 16 , MimeTypeWarning = 17 ,
  DDocError = 512
}
 
using Causes = std::vector< Exception >
 

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)
 
 Exception (const Exception &other)
 
 Exception (Exception &&other) noexcept
 
virtual ~Exception ()
 
Exceptionoperator= (const Exception &other)
 
Exceptionoperator= (Exception &&other) noexcept
 
std::string file () const
 
int line () const
 
ExceptionCode code () const
 
std::string msg () const
 
Causes causes () const
 
void addCause (const Exception &cause)
 
void setCode (ExceptionCode Code)
 

Static Public Member Functions

static void addWarningIgnore (ExceptionCode code)
 
static void setWarningIgnoreList (const std::vector< ExceptionCode > &list)
 
static bool hasWarningIgnore (ExceptionCode code)
 

Detailed Description

Base exception class of the digidoc implementation.

Member Typedef Documentation

◆ Causes

using digidoc::Exception::Causes = std::vector<Exception>

Member Enumeration Documentation

◆ ExceptionCode

Exception code

Enumerator
General 

General error, no specific code

NetworkError 

Network error, network connection errors

HostNotFound 

Network error, host not found

InvalidUrl 

Network error, invalid URL

CertificateIssuerMissing 

Signer's certificate's issuer certificate is missing

CertificateRevoked 

Certificate status is revoked in OCSP response

CertificateUnknown 

Certificate status is unknown in OCSP response

OCSPBeforeTimeStamp 

OCSP producedAt time is before TimeStamp time

OCSPResponderMissing 

OCSP Responder is missing

OCSPCertMissing 

OCSP Responder certificate is missing

OCSPTimeSlot 

OCSP Response is not in valid time slot

OCSPRequestUnauthorized 

OCSP Responder requires the OCSP request to be signed

TSForbidden 

TSA service responds forbidden

TSTooManyRequests 

TSA service requests have reached limit

PINCanceled 

PIN cancelled exception

PINFailed 

PIN verification error

PINIncorrect 

PIN incorrect error

PINLocked 

PIN locked error

ReferenceDigestWeak 

One or more referenced objects in container are calculated by using weaker digest method that recommended

SignatureDigestWeak 

The digest that is signed in container has been calculated by using weaker digest method than recommended

DataFileNameSpaceWarning 

DDoc warning: <DataFile> XML element is missing xmlns attribute

IssuerNameSpaceWarning 

DDoc warning: <X509IssuerName> and/or <X509IssuerSerial> XML element is missing xmlns attribute

ProducedATLateWarning 

TimeStamp and OCSP time difference is more than 15 minutes

MimeTypeWarning 

Mime type is not conformant mime-type strings

DDocError 

DDoc libdigidoc error codes bit masked

Deprecated:
Unused

Constructor & Destructor Documentation

◆ Exception() [1/4]

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

◆ Exception() [2/4]

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
filesource file name, where the exception was thrown.
lineline of the file, where the exception was thrown.
msgerror message.
causecause of the exception.
See also
causes()

References addCause().

◆ Exception() [3/4]

Exception::Exception ( const Exception other)
default

Copy constructor

◆ Exception() [4/4]

Exception::Exception ( Exception &&  other)
defaultnoexcept

Move constructor

◆ ~Exception()

Exception::~Exception ( )
virtualdefault

Releases memory

Member Function Documentation

◆ addCause()

void Exception::addCause ( const Exception cause)

Adds child Exception

Referenced by Exception().

◆ addWarningIgnore()

void Exception::addWarningIgnore ( ExceptionCode  code)
static

Ignore Warning exceptions globaly

Parameters
codePush additional exception to list

References code().

◆ causes()

Exception::Causes Exception::causes ( ) const

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

◆ code()

Exception::ExceptionCode Exception::code ( ) const

Returns exception code

Referenced by addWarningIgnore(), hasWarningIgnore(), and setCode().

◆ file()

string Exception::file ( ) const

Returns exception file

◆ hasWarningIgnore()

bool Exception::hasWarningIgnore ( ExceptionCode  code)
static

Verifies if Warning exception is in igonre list

References code().

◆ line()

int Exception::line ( ) const

Returns exception line

◆ msg()

string Exception::msg ( ) const

Returns error message.

◆ operator=() [1/2]

Exception & Exception::operator= ( const Exception other)
default

Copy operator

◆ operator=() [2/2]

Exception & Exception::operator= ( Exception &&  other)
defaultnoexcept

Move operator

◆ setCode()

void Exception::setCode ( ExceptionCode  code)

Sets exception code

References code().

Referenced by digidoc::PKCS11Signer::sign().

◆ setWarningIgnoreList()

void Exception::setWarningIgnoreList ( const std::vector< ExceptionCode > &  list)
static

Ignore Warning exceptions globaly

Parameters
listSet new exception list

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