libstorage-ng
Loading...
Searching...
No Matches
storage::IndexOutOfRangeException Class Reference

Exception class for "index out of range". More...

#include <Exception.h>

Inheritance diagram for storage::IndexOutOfRangeException:
[legend]
Collaboration diagram for storage::IndexOutOfRangeException:
[legend]

Public Member Functions

 IndexOutOfRangeException (int invalidIndex, int validMin, int validMax, const std::string &msg="")
 Constructor.
int invalidIndex () const
 Return the offending index value.
int validMin () const
 Return the valid minimum index.
int validMax () const
 Return the valid maximum index.
Public Member Functions inherited from storage::Exception
 Exception (LogLevel log_level=LogLevel::ERROR)
 Default constructor.
 Exception (const std::string &msg, LogLevel log_level=LogLevel::ERROR)
 Constructor taking a message.
virtual ~Exception () noexcept
 Destructor.
const CodeLocationwhere () const
 Return CodeLocation.
void relocate (const CodeLocation &newLocation) const
 Exchange location on rethrow.
const std::string & msg () const
 Return the message string provided to the constructor.
LogLevel log_level () const
void setMsg (const std::string &msg)
 Set a new message string.
std::string asString () const
 Error message provided by dumpOn as string.
virtual const char * what () const noexcept override
 Return message string.

Protected Member Functions

virtual std::ostream & dumpOn (std::ostream &str) const override
 Write proper error message with all relevant data.

Additional Inherited Members

Static Public Member Functions inherited from storage::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)
 Make a string from errno_r and msg_r.
static void log (const Exception &exception, const CodeLocation &location, const char *const prefix)
 Drop a log line on throw, catch or rethrow.

Detailed Description

Exception class for "index out of range".

Constructor & Destructor Documentation

◆ IndexOutOfRangeException()

storage::IndexOutOfRangeException::IndexOutOfRangeException ( int invalidIndex,
int validMin,
int validMax,
const std::string & msg = "" )
inline

Constructor.

'invalidIndex' is the offending index value. It should be between 'validMin' and 'validMax':

 validMin <= index <= validMax

Member Function Documentation

◆ dumpOn()

virtual std::ostream & storage::IndexOutOfRangeException::dumpOn ( std::ostream & str) const
inlineoverrideprotectedvirtual

Write proper error message with all relevant data.

Reimplemented from Exception.

Reimplemented from storage::Exception.


The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/libstorage-ng-4.5.266-build/libstorage-ng-4.5.266/storage/Utils/Exception.h