int DigiDocSignature::parseException( const digidoc::Exception &e ) const { Q_FOREACH( const Exception &c, e.getCauses() ) { int code = parseException( c ); if( code != Exception::NoException ) return code; } return e.code(); }
void DigiDocSignature::parseException( DigiDocSignature::SignatureStatus &result, const digidoc::Exception &e ) const { Q_FOREACH( const Exception &child, e.causes() ) { switch( child.code() ) { case Exception::RefereneceDigestWeak: case Exception::SignatureDigestWeak: m_warning |= DigestWeak; result = std::max( result, Warning ); break; case Exception::DataFileNameSpaceWarning: case Exception::IssuerNameSpaceWarning: m_warning |= WrongNameSpace; result = std::max( result, Warning ); break; case Exception::CertificateIssuerMissing: case Exception::CertificateUnknown: case Exception::OCSPResponderMissing: case Exception::OCSPCertMissing: result = std::max( result, Unknown ); break; default: result = std::max( result, Invalid ); } parseException( result, child ); } }
void getExceptionMsg(const digidoc::Exception& e , std::stringstream& addTo , size_t depth ) { addTo << indent(depth) << "Exception[" << e.getMsg() << "]" << std::endl; if ( e.hasCause() ) { digidoc::Exception::Causes causedBy = e.getCauses(); addTo << indent(depth + 1) << "Caused by:" << std::endl; for ( digidoc::Exception::Causes::const_iterator it = causedBy.begin() ; it != causedBy.end() ; it++ ) { getExceptionMsg(*it, addTo, depth + 1); // recurse } } }
void TSL::debugException(const digidoc::Exception &e) { Log::out(Log::DebugType, e.file().c_str(), e.line(), e.msg().c_str()); for(const Exception &ex: e.causes()) debugException(ex); }