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();
102 {
remember( std::move(history_r) ); }
106 {
remember( std::move(history_r) ); }
113 std::ostringstream
str;
120 std::ostringstream
str;
124 return _(
str.str().c_str());
143 if ( &old_r !=
this )
153 if ( &old_r !=
this )
155 History & newh( old_r._history );
156 newh.push_front( old_r.asUserString() );
165 std::rethrow_exception(std::move(old_r));
169 }
catch (
const std::exception& e ) {
180 {
_history.push_front( std::move(msg_r) ); }
184 std::ostringstream ret;
186 ret <<
_(
"History:");
187 for (
const std::string & entry :
_history ) {
188 strv::split( entry,
"\n", [&ret]( std::string_view line_r,
unsigned idx,
bool last_r ) ->
void {
189 if ( not ( last_r && line_r.empty() ) )
190 ret << endl << (idx==0?
" - ":
" ") << line_r;
213 return msg_r +=
strErrno( errno_r );
217 const char *
const prefix_r )
219 INT << where_r <<
" " << prefix_r <<
" " << excpt_r.
asUserHistory() << endl;
223 const char *
const prefix_r )
225 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, const CodeLocation &where_r)
Helper for ZYPP_FWD_CURRENT_EXCPT().
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.