: _msg( msg_r )
{}
+ Exception::Exception( const std::string & msg_r, const Exception & history_r )
+ : _msg( msg_r )
+ { remember( history_r ); }
+
Exception::~Exception() throw()
{}
void Exception::log( const Exception & excpt_r, const CodeLocation & where_r,
const char *const prefix_r )
{
- INT << where_r << " " << prefix_r << " " << excpt_r << endl;
+ INT << where_r << " " << prefix_r << " " << excpt_r.asUserHistory() << endl;
}
/////////////////////////////////////////////////////////////////
: Exception( msg_r ), _kind( UNSPECIFIED )
{}
+ UserRequestException::UserRequestException( const std::string & msg_r, const Exception & history_r )
+ : Exception( msg_r, history_r ), _kind( UNSPECIFIED )
+ {}
+
UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r )
: Exception( msg_r ), _kind( kind_r )
{}
+ UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r )
+ : Exception( msg_r, history_r ), _kind( kind_r )
+ {}
+
///////////////////////////////////////////////////////////////////
//
// METHOD NAME : UserRequestException::dumpOn
public:
explicit
UserRequestException( const std::string & msg_r = std::string() );
+ UserRequestException( const std::string & msg_r, const Exception & history_r );
explicit
UserRequestException( Kind kind_r, const std::string & msg_r = std::string() );
+ UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r );
public:
Kind kind() const
{ return _kind; }
};
///////////////////////////////////////////////////////////////////
- struct IgnoreRequestException : public UserRequestException
- {
- explicit
- IgnoreRequestException( const std::string & msg_r = std::string() )
- : UserRequestException( IGNORE, msg_r )
- {}
- };
+ /** Convenience macro to declare more specific PluginScriptExceptions. */
+#define declException( EXCP, KIND ) \
+ struct EXCP : public UserRequestException { \
+ explicit \
+ EXCP( const std::string & msg_r = std::string() ) \
+ : UserRequestException( KIND, msg_r ) \
+ {} \
+ EXCP( const std::string & msg_r, const Exception & history_r ) \
+ : UserRequestException( KIND, msg_r, history_r ) \
+ {} \
+ }
- struct SkipRequestException : public UserRequestException
- {
- explicit
- SkipRequestException( const std::string & msg_r = std::string() )
- : UserRequestException( SKIP, msg_r )
- {}
- };
+ declException( IgnoreRequestException, IGNORE );
+ declException( SkipRequestException, SKIP );
+ declException( RetryRequestException, RETRY );
+ declException( AbortRequestException, ABORT );
- struct RetryRequestException : public UserRequestException
- {
- explicit
- RetryRequestException( const std::string & msg_r = std::string() )
- : UserRequestException( RETRY, msg_r )
- {}
- };
-
- struct AbortRequestException : public UserRequestException
- {
- explicit
- AbortRequestException( const std::string & msg_r = std::string() )
- : UserRequestException( ABORT, msg_r )
- {}
- };
+#undef declException
/////////////////////////////////////////////////////////////////
} // namespace zypp