libstorage-ng
Public Member Functions | List of all members
storage::ParseException Class Reference

Exception class for parse errors, e.g. More...

#include <Exception.h>

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

Public Member Functions

 ParseException (const std::string &msg, const std::string &seen, const std::string &expected)
 Constructor. More...
 
virtual ~ParseException () noexcept
 Destructor.
 
const std::string & seen () const
 The offending line that caused the parse error.
 
const std::string & expected () const
 Short textual description of what the parser expected.
 
virtual std::ostream & dumpOn (std::ostream &str) const override
 Write proper error message with all relevant data. More...
 
- Public Member Functions inherited from storage::Exception
 Exception (LogLevel log_level=LogLevel::ERROR)
 Default constructor. More...
 
 Exception (const std::string &msg, LogLevel log_level=LogLevel::ERROR)
 Constructor taking a message. More...
 
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. More...
 
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. More...
 

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. More...
 

Detailed Description

Exception class for parse errors, e.g.

when parsing the output of external commands like "parted".

Constructor & Destructor Documentation

◆ ParseException()

storage::ParseException::ParseException ( const std::string &  msg,
const std::string &  seen,
const std::string &  expected 
)
inline

Constructor.

'seen' the offending line that was to be parsed, 'expected' what the parser expected, 'msg' is an optional more exact error message (beyond "Parse error").

Member Function Documentation

◆ dumpOn()

virtual std::ostream& storage::ParseException::dumpOn ( std::ostream &  str) const
inlineoverridevirtual

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: