libzypp 17.31.23
zypp::UserRequestException Class Reference

Base for exceptions caused by explicit user request. More...

#include <base/userrequestexception.h>

Inheritance diagram for zypp::UserRequestException:

Public Types

enum  Kind {
  UNSPECIFIED , IGNORE , SKIP , RETRY ,
  ABORT
}
 
- Public Types inherited from zypp::Exception
typedef exception_detail::CodeLocation CodeLocation
 
typedef std::list< std::string > History
 
typedef History::const_iterator HistoryIterator
 
typedef History::size_type HistorySize
 

Public Member Functions

 UserRequestException (const std::string &msg_r=std::string())
 
 UserRequestException (const std::string &msg_r, const Exception &history_r)
 
 UserRequestException (Kind kind_r, const std::string &msg_r=std::string())
 
 UserRequestException (Kind kind_r, const std::string &msg_r, const Exception &history_r)
 
Kind kind () const
 
- Public Member Functions inherited from zypp::Exception
 Exception ()
 Default ctor.
 
 Exception (const std::string &msg_r)
 Ctor taking a message.
 
 Exception (std::string &&msg_r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 Exception (const std::string &msg_r, const Exception &history_r)
 Ctor taking a message and an exception to remember as history.
 
 Exception (std::string &&msg_r, const Exception &history_r)
 
 Exception (const std::string &msg_r, Exception &&history_r)
 
 Exception (std::string &&msg_r, Exception &&history_r)
 
virtual ~Exception () throw ()
 Dtor.
 
const CodeLocationwhere () const
 Return CodeLocation.
 
void relocate (const CodeLocation &where_r) const
 Exchange location on rethrow.
 
const std::string & msg () const
 Return the message string provided to the ctor.
 
std::string asString () const
 Error message provided by dumpOn as string.
 
std::string asUserString () const
 Translated error message as string suitable for the user.
 
void remember (const Exception &old_r)
 Store an other Exception as history.
 
void remember (Exception &&old_r)
 
void remember (std::exception_ptr old_r)
 
void remember (const std::string &msg_r)
 Remembering a plain string is most probably not wanted - we addHistory.
 
void remember (std::string &&msg_r)
 
void addHistory (const std::string &msg_r)
 Add some message text to the history.
 
void addHistory (std::string &&msg_r)
 
template<class TContainer >
void addToHistory (const TContainer &msgc_r)
 addHistory from string container types (oldest first)
 
template<class TContainer >
void moveToHistory (TContainer &&msgc_r)
 addHistory from string container types (oldest first) moving
 
HistoryIterator historyBegin () const
 Iterator pointing to the most recent message.
 
HistoryIterator historyEnd () const
 Iterator pointing behind the last message.
 
bool historyEmpty () const
 Whether the history list is empty.
 
HistorySize historySize () const
 The size of the history list.
 
std::string historyAsString () const
 The history as string.
 
std::string asUserHistory () const
 A single (multiline) string composed of asUserString and historyAsString.
 

Protected Member Functions

virtual std::ostream & dumpOn (std::ostream &str) const
 Overload this to print a proper error message.
 
- Protected Member Functions inherited from zypp::Exception

Private Attributes

Kind _kind
 

Additional Inherited Members

- Static Public Member Functions inherited from zypp::Exception
static std::string strErrno (int errno_r)
 Make a string from errno_r.
 
static std::string strErrno (int errno_r, const std::string &msg_r)
 Make a string from errno_r and msg_r.
 
static std::string strErrno (int errno_r, std::string &&msg_r)
 
static void log (const Exception &excpt_r, const CodeLocation &where_r, const char *const prefix_r)
 Drop a logline on throw, catch or rethrow.
 
static void log (const char *typename_r, const CodeLocation &where_r, const char *const prefix_r)
 \overrload for not-Exception types thrown via ZYPP_THROW
 

Detailed Description

Base for exceptions caused by explicit user request.

Use the derived convenience classes to throw exceptions of a certain kind.

ProgressData ticks( makeProgressData( input_r ) );
ticks.sendTo( fnc_r );
ticks.toMin(); // start sending min (0)
iostr::EachLine line( input_r );
for( ; line; line.next() )
{
// process the line
if ( ! ticks.set( input_r.stream().tellg() ) )
ZYPP_THROW( AbortRequestException( "" ) );
}
Maintain [min,max] and counter (value) for progress counting.
Definition: progressdata.h:132
Simple lineparser: Traverse each line in a file.
Definition: IOStream.h:112
ProgressData makeProgressData(const InputStream &input_r)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:428
// either this way
catch ( const AbortRequestException & excpt_r )
{
...
}
// or that
catch ( const UserRequestException & excpt_r )
{
switch ( excpt_r.kind() )
{
...
break;
}
}
Base for exceptions caused by explicit user request.

Definition at line 64 of file userrequestexception.h.

Member Enumeration Documentation

◆ Kind

Enumerator
UNSPECIFIED 
IGNORE 
SKIP 
RETRY 
ABORT 

Definition at line 67 of file userrequestexception.h.

Constructor & Destructor Documentation

◆ UserRequestException() [1/4]

zypp::UserRequestException::UserRequestException ( const std::string &  msg_r = std::string())
explicit

Definition at line 28 of file userrequestexception.cc.

◆ UserRequestException() [2/4]

zypp::UserRequestException::UserRequestException ( const std::string &  msg_r,
const Exception history_r 
)

Definition at line 32 of file userrequestexception.cc.

◆ UserRequestException() [3/4]

zypp::UserRequestException::UserRequestException ( Kind  kind_r,
const std::string &  msg_r = std::string() 
)
explicit

Definition at line 36 of file userrequestexception.cc.

◆ UserRequestException() [4/4]

zypp::UserRequestException::UserRequestException ( Kind  kind_r,
const std::string &  msg_r,
const Exception history_r 
)

Definition at line 40 of file userrequestexception.cc.

Member Function Documentation

◆ kind()

Kind zypp::UserRequestException::kind ( ) const
inline

Definition at line 76 of file userrequestexception.h.

◆ dumpOn()

std::ostream & zypp::UserRequestException::dumpOn ( std::ostream &  str) const
protectedvirtual

Overload this to print a proper error message.

Reimplemented from zypp::Exception.

Definition at line 49 of file userrequestexception.cc.

Member Data Documentation

◆ _kind

Kind zypp::UserRequestException::_kind
private

Definition at line 81 of file userrequestexception.h.


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