libzypp 17.31.23
Exception.h File Reference
#include <zypp-core/base/Exception.h>
#include <iosfwd>
#include <string>
#include <list>
#include <stdexcept>
#include <typeinfo>
#include <type_traits>
#include <zypp-core/base/Errno.h>
Include dependency graph for Exception.h:

Go to the source code of this file.

Classes

struct  zypp::exception_detail::CodeLocation
 Keep FILE, FUNCTION and LINE. More...
 
class  zypp::Exception
 Base class for Exception. More...
 

Namespaces

namespace  zypp
 Easy-to use interface to the ZYPP dependency resolver.
 
namespace  zypp::exception_detail
 

Macros

#define ZYPP_EX_CODELOCATION   ::zypp::exception_detail::CodeLocation(( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ ),__FUNCTION__,__LINE__)
 Create CodeLocation object storing the current location.
 
#define ZYPP_THROW(EXCPT)    ::zypp::exception_detail::do_ZYPP_THROW( EXCPT, ZYPP_EX_CODELOCATION )
 Drops a logline and throws the Exception.
 
#define ZYPP_EXCPT_PTR(EXCPT)    ::zypp::exception_detail::do_ZYPP_EXCPT_PTR( EXCPT, ZYPP_EX_CODELOCATION )
 Drops a logline and returns Exception as a std::exception_ptr.
 
#define ZYPP_CAUGHT(EXCPT)    ::zypp::exception_detail::do_ZYPP_CAUGHT( EXCPT, ZYPP_EX_CODELOCATION )
 Drops a logline telling the Exception was caught (in order to handle it).
 
#define ZYPP_RETHROW(EXCPT)    ::zypp::exception_detail::do_ZYPP_RETHROW( EXCPT, ZYPP_EX_CODELOCATION )
 Drops a logline and rethrows, updating the CodeLocation.
 
#define ZYPP_THROW_MSG(EXCPTTYPE, MSG)    ZYPP_THROW( EXCPTTYPE( MSG ) )
 Throw Exception built from a message string.
 
#define ZYPP_THROW_ERRNO(EXCPTTYPE)    ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno) ) )
 Throw Exception built from errno.
 
#define ZYPP_THROW_ERRNO1(EXCPTTYPE, ERRNO)    ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO) ) )
 Throw Exception built from errno provided as argument.
 
#define ZYPP_THROW_ERRNO_MSG(EXCPTTYPE, MSG)    ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno,MSG) ) )
 Throw Exception built from errno and a message string.
 
#define ZYPP_THROW_ERRNO_MSG1(EXCPTTYPE, ERRNO, MSG)    ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO,MSG) ) )
 Throw Exception built from errno provided as argument and a message string.
 

Typedefs

template<class TExcpt >
using zypp::exception_detail::EnableIfIsException = typename std::enable_if< std::is_base_of< Exception, TExcpt >::value, int >::type
 SFINAE: Hide template signature unless TExcpt is derived from Exception.
 
template<class TExcpt >
using zypp::exception_detail::EnableIfNotException = typename std::enable_if< !std::is_base_of< Exception, TExcpt >::value, int >::type
 SFINAE: Hide template signature if TExcpt is derived from Exception.
 

Functions

template<class TExcpt , EnableIfIsException< TExcpt > = 0>
void zypp::exception_detail::do_ZYPP_THROW (const TExcpt &excpt_r, const CodeLocation &where_r) __attribute__((noreturn))
 Helper for ZYPP_THROW( Exception ).
 
template<class TExcpt , EnableIfIsException< TExcpt > = 0>
void zypp::exception_detail::do_ZYPP_CAUGHT (const TExcpt &excpt_r, const CodeLocation &where_r)
 Helper for ZYPP_THROW( Exception ).
 
template<class TExcpt , EnableIfIsException< TExcpt > = 0>
void zypp::exception_detail::do_ZYPP_RETHROW (const TExcpt &excpt_r, const CodeLocation &where_r) __attribute__((noreturn))
 Helper for ZYPP_THROW( Exception ).
 
template<class TExcpt , EnableIfIsException< TExcpt > = 0>
std::exception_ptr zypp::exception_detail::do_ZYPP_EXCPT_PTR (const TExcpt &excpt_r, const CodeLocation &where_r)
 Helper for ZYPP_EXCPT_PTR( Exception ).
 

Macro Definition Documentation

◆ ZYPP_EX_CODELOCATION

#define ZYPP_EX_CODELOCATION   ::zypp::exception_detail::CodeLocation(( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ ),__FUNCTION__,__LINE__)

Create CodeLocation object storing the current location.

Definition at line 62 of file Exception.h.

◆ ZYPP_THROW

#define ZYPP_THROW (   EXCPT)     ::zypp::exception_detail::do_ZYPP_THROW( EXCPT, ZYPP_EX_CODELOCATION )

Drops a logline and throws the Exception.

Definition at line 428 of file Exception.h.

◆ ZYPP_EXCPT_PTR

#define ZYPP_EXCPT_PTR (   EXCPT)     ::zypp::exception_detail::do_ZYPP_EXCPT_PTR( EXCPT, ZYPP_EX_CODELOCATION )

Drops a logline and returns Exception as a std::exception_ptr.

Definition at line 432 of file Exception.h.

◆ ZYPP_CAUGHT

#define ZYPP_CAUGHT (   EXCPT)     ::zypp::exception_detail::do_ZYPP_CAUGHT( EXCPT, ZYPP_EX_CODELOCATION )

Drops a logline telling the Exception was caught (in order to handle it).

Definition at line 436 of file Exception.h.

◆ ZYPP_RETHROW

#define ZYPP_RETHROW (   EXCPT)     ::zypp::exception_detail::do_ZYPP_RETHROW( EXCPT, ZYPP_EX_CODELOCATION )

Drops a logline and rethrows, updating the CodeLocation.

Definition at line 440 of file Exception.h.

◆ ZYPP_THROW_MSG

#define ZYPP_THROW_MSG (   EXCPTTYPE,
  MSG 
)     ZYPP_THROW( EXCPTTYPE( MSG ) )

Throw Exception built from a message string.

Definition at line 445 of file Exception.h.

◆ ZYPP_THROW_ERRNO

#define ZYPP_THROW_ERRNO (   EXCPTTYPE)     ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno) ) )

Throw Exception built from errno.

Definition at line 449 of file Exception.h.

◆ ZYPP_THROW_ERRNO1

#define ZYPP_THROW_ERRNO1 (   EXCPTTYPE,
  ERRNO 
)     ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO) ) )

Throw Exception built from errno provided as argument.

Definition at line 453 of file Exception.h.

◆ ZYPP_THROW_ERRNO_MSG

#define ZYPP_THROW_ERRNO_MSG (   EXCPTTYPE,
  MSG 
)     ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(errno,MSG) ) )

Throw Exception built from errno and a message string.

Definition at line 457 of file Exception.h.

◆ ZYPP_THROW_ERRNO_MSG1

#define ZYPP_THROW_ERRNO_MSG1 (   EXCPTTYPE,
  ERRNO,
  MSG 
)     ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO,MSG) ) )

Throw Exception built from errno provided as argument and a message string.

Definition at line 461 of file Exception.h.