47        std::rethrow_exception (excpt_r);
 
   51      } 
catch ( 
const std::exception & e ) {
 
 
   63      std::rethrow_exception( excpt_r );
 
   67      return std::current_exception();
 
   68    } 
catch ( 
const std::exception & e ) {
 
   69      Exception::log( 
typeid(e).name(), where_r, 
"RETHROW (FWD) EXCPTR:   " );
 
   70      return std::current_exception();
 
   72      Exception::log( 
"Unknown Exception", where_r, 
"RETHROW (FWD) EXCPTR:   " );
 
   73      return std::current_exception();
 
 
   80      std::rethrow_exception( excpt_r );
 
   83    } 
catch ( 
const std::exception & e ) {
 
 
 
  115  { 
remember( std::move(history_r) ); }
 
 
  119  { 
remember( std::move(history_r) ); }
 
 
  126    std::ostringstream 
str;
 
 
  133    std::ostringstream 
str;
 
  137    return _(
str.str().c_str());
 
 
  156    if ( &old_r != 
this ) 
 
 
  166    if ( &old_r != 
this ) 
 
  168      History & newh( old_r._history );  
 
  169      newh.push_front( old_r.asUserString() );
 
 
  178        std::rethrow_exception(std::move(old_r));
 
  182    } 
catch ( 
const std::exception& e ) {
 
 
  193  { 
_history.push_front( std::move(msg_r) ); }
 
 
  197    std::ostringstream ret;
 
  199      ret << 
_(
"History:");
 
  200      for ( 
const std::string & entry : 
_history ) {
 
  201        strv::split( entry, 
"\n", [&ret]( std::string_view line_r, 
unsigned idx, 
bool last_r ) -> 
void {
 
  202          if ( not ( last_r && line_r.empty() ) )
 
  203            ret  << endl << (idx==0?
" - ":
"   ") << line_r;
 
 
  219  std::ostream & 
operator<<( std::ostream & 
str, 
const std::exception_ptr &excptPtr )
 
  222      std::rethrow_exception (excptPtr) ;
 
  225    } 
catch ( 
const std::exception &e ) {
 
  226      str << 
"std::exception: (" << e.
what() << 
")";
 
  228      str << 
"Unknown exception";
 
 
  239    return msg_r += 
strErrno( errno_r );
 
 
  243                       const char *
const prefix_r )
 
  245    INT << where_r << 
" " << prefix_r << 
" " << excpt_r.
asUserHistory() << endl;
 
 
  249                       const char *
const prefix_r )
 
  251    INT << where_r << 
" " << prefix_r << 
" exception of type " << typename_r << endl;
 
 
Base class for Exception.
static std::string strErrno(int errno_r)
Make a string from errno_r.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
std::ostream & dumpError(std::ostream &str) const
Called by std::ostream & operator<<.
std::string asUserString() const
Translated error message as string suitable for the user.
void addHistory(const std::string &msg_r)
Add some message text to the history.
std::string historyAsString() const
The history as string.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
std::string asString() const
Error message provided by dumpOn as string.
static void log(const Exception &excpt_r, const CodeLocation &where_r, const char *const prefix_r)
Drop a logline on throw, catch or rethrow.
const char * what() const override
Return message string.
~Exception() override
Dtor.
exception_detail::CodeLocation CodeLocation
std::list< std::string > History
void relocate(const CodeLocation &where_r) const
Exchange location on rethrow.
bool historyEmpty() const
Whether the history list is empty.
void remember(const Exception &old_r)
Store an other Exception as history.
String related utilities and Regular expression matching.
void do_ZYPP_RETHROW(const std::exception_ptr &excpt_r, const CodeLocation &where_r)
std::exception_ptr do_ZYPP_FWD_EXCPT_PTR(const std::exception_ptr &excpt_r, CodeLocation &&where_r)
Helper for ZYPP_FWD_CURRENT_EXCPT().
void do_ZYPP_CAUGHT(const std::exception_ptr &excpt_r, CodeLocation &&where_r)
Helper for std::exception_ptr.
std::ostream & operator<<(std::ostream &str, const CodeLocation &obj)
std::string strerror(int errno_r)
Return string describing the error_r code.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Keep FILE, FUNCTION and LINE.
std::string asString() const
Location as string.