bool DigiDoc::parseException( const Exception &e, QStringList &causes, Exception::ExceptionCode &code, int &ddocError ) { causes << from( e.getMsg() ); if( e.ddoc() > 0 ) ddocError = e.ddoc(); switch( e.code() ) { case Exception::CertificateRevoked: case Exception::CertificateUnknown: case Exception::OCSPTimeSlot: case Exception::OCSPRequestUnauthorized: case Exception::PINCanceled: case Exception::PINFailed: case Exception::PINIncorrect: case Exception::PINLocked: code = e.code(); return false; default: break; } Q_FOREACH( const Exception &c, e.getCauses() ) if( !parseException( c, causes, code, ddocError ) ) return false; return true; }
std::string traceException(const Exception &e) { std::string msg = e.getMsg() + '\n'; Exception::Causes causes = e.getCauses(); Exception::Causes::iterator it; for (it = causes.begin(); it < causes.end(); it++) { msg += traceException(*it); } return msg; }