An exception that is thrown when a record is requested from a page that has a bad record ID. More...
#include <invalid_record_exception.h>
Public Member Functions | |
InvalidRecordException (const RecordId &rec_id, const PageId page_num) | |
virtual const RecordId & | record_id () const |
virtual PageId | page_number () const |
virtual const std::string & | message () const |
virtual const char * | what () const throw () |
Protected Attributes | |
const RecordId | record_id_ |
const PageId | page_number_ |
std::string | message_ |
Friends | |
std::ostream & | operator<< (std::ostream &out, const BadgerDbException &exception) |
An exception that is thrown when a record is requested from a page that has a bad record ID.
Definition at line 21 of file invalid_record_exception.h.
badgerdb::InvalidRecordException::InvalidRecordException | ( | const RecordId & | rec_id, |
const PageId | page_num | ||
) |
Constructs an invalid record exception for the given requested record ID and page number.
rec_id | Requested record ID. |
page_num | Page from which record is requested. |
Definition at line 15 of file invalid_record_exception.cpp.
: BadgerDbException(""), record_id_(rec_id), page_number_(page_num) { std::stringstream ss; ss << "Request made for an invalid record." << " Record {page=" << record_id_.page_number << ", slot=" << record_id_.slot_number << "} from page " << page_number_; message_.assign(ss.str()); }
virtual const std::string& badgerdb::BadgerDbException::message | ( | ) | const [inline, virtual, inherited] |
Returns a message describing the problem that caused this exception.
Definition at line 38 of file badgerdb_exception.h.
{ return message_; }
virtual PageId badgerdb::InvalidRecordException::page_number | ( | ) | const [inline, virtual] |
Returns the page number of the page that caused this exception.
Definition at line 41 of file invalid_record_exception.h.
{ return page_number_; }
virtual const RecordId& badgerdb::InvalidRecordException::record_id | ( | ) | const [inline, virtual] |
Returns the requested record ID that caused this exception.
Definition at line 36 of file invalid_record_exception.h.
{ return record_id_; }
virtual const char* badgerdb::BadgerDbException::what | ( | ) | const throw () [inline, virtual, inherited] |
Returns a description of the exception.
Definition at line 45 of file badgerdb_exception.h.
{ return message_.c_str(); }
std::ostream& operator<< | ( | std::ostream & | out, |
const BadgerDbException & | exception | ||
) | [friend, inherited] |
Formats this exception for printing on the given stream.
out | Stream to print exception to. |
exception | Exception to print. |
Definition at line 54 of file badgerdb_exception.h.
{
out << exception.message();
return out;
}
std::string badgerdb::BadgerDbException::message_ [protected, inherited] |
Message describing the problem that caused this exception.
Definition at line 64 of file badgerdb_exception.h.
const PageId badgerdb::InvalidRecordException::page_number_ [protected] |
Page number of page which caused this exception.
Definition at line 52 of file invalid_record_exception.h.
const RecordId badgerdb::InvalidRecordException::record_id_ [protected] |
Record ID which caused this exception.
Definition at line 47 of file invalid_record_exception.h.