libfoedus-core
FOEDUS Core Library
|
Representation of ErrorStack that can be copied to other processes and even serialized to files. More...
Representation of ErrorStack that can be copied to other processes and even serialized to files.
ErrorStack contains char*, so can't be trivially passed to other processes or serialized. This object is used in such a situation. It does string copying and (if too long) truncation, so do not use this unless required.
Definition at line 41 of file fixed_error_stack.hpp.
#include <fixed_error_stack.hpp>
Public Types | |
typedef assorted::FixedString< 124 > | FixedFileName |
typedef assorted::FixedString< 124 > | FixedFuncName |
typedef assorted::FixedString< 508 > | FixedErrorMessage |
Public Member Functions | |
FixedErrorStack () | |
Empty constructor. More... | |
FixedErrorStack (const ErrorStack &src) | |
Copy the content of the given ErrorStack. More... | |
FixedErrorStack & | operator= (const ErrorStack &src) |
Assignment operator. More... | |
bool | is_error () const |
Returns if this return code is not kErrorCodeOk. More... | |
ErrorCode | get_error_code () const |
Return the integer error code. More... | |
const char * | get_message () const |
Returns the error message inferred by the error code. More... | |
const FixedErrorMessage & | get_custom_message () const |
Returns the custom error message. More... | |
uint16_t | get_stack_depth () const |
Returns the depth of stack this error code has collected. More... | |
uint32_t | get_linenum (uint16_t stack_index) const |
Returns the line number of the given stack position. More... | |
const FixedFileName & | get_filename (uint16_t stack_index) const |
Returns the file name of the given stack position. More... | |
const FixedFuncName & | get_func (uint16_t stack_index) const |
Returns the function name of the given stack position. More... | |
void | output (std::ostream *ptr) const |
Describe this object to the given stream. More... | |
void | clear () |
ErrorStack | to_error_stack () const |
Instantiates an ErrorStack object based on this object. More... | |
void | from_error_stack (const ErrorStack &other) |
Convert ErrorStack to this object. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const FixedErrorStack &obj) |
Definition at line 45 of file fixed_error_stack.hpp.
Definition at line 43 of file fixed_error_stack.hpp.
Definition at line 44 of file fixed_error_stack.hpp.
|
inline |
|
inlineexplicit |
Copy the content of the given ErrorStack.
Definition at line 50 of file fixed_error_stack.hpp.
References operator=().
|
inline |
Definition at line 91 of file fixed_error_stack.hpp.
References foedus::kErrorCodeOk.
Referenced by from_error_stack(), and foedus::thread::ThreadControlBlock::initialize().
void foedus::FixedErrorStack::from_error_stack | ( | const ErrorStack & | other | ) |
Convert ErrorStack to this object.
Opposite of to_error_stack
Definition at line 85 of file fixed_error_stack.cpp.
References clear(), foedus::assorted::FixedString< MAXLEN, CHAR >::clear(), foedus::ErrorStack::get_custom_message(), foedus::ErrorStack::get_error_code(), foedus::ErrorStack::get_filename(), foedus::ErrorStack::get_func(), foedus::ErrorStack::get_linenum(), foedus::ErrorStack::get_os_errno(), foedus::ErrorStack::get_stack_depth(), and foedus::ErrorStack::is_error().
|
inline |
Returns the custom error message.
Definition at line 65 of file fixed_error_stack.hpp.
Referenced by output().
|
inline |
Return the integer error code.
Definition at line 59 of file fixed_error_stack.hpp.
|
inline |
Returns the file name of the given stack position.
Definition at line 77 of file fixed_error_stack.hpp.
References ASSERT_ND.
Referenced by output().
|
inline |
Returns the function name of the given stack position.
Definition at line 83 of file fixed_error_stack.hpp.
References ASSERT_ND.
Referenced by output().
|
inline |
Returns the line number of the given stack position.
Definition at line 71 of file fixed_error_stack.hpp.
References ASSERT_ND.
Referenced by output().
|
inline |
Returns the error message inferred by the error code.
Definition at line 62 of file fixed_error_stack.hpp.
References foedus::get_error_message().
Referenced by output().
|
inline |
Returns the depth of stack this error code has collected.
Definition at line 68 of file fixed_error_stack.hpp.
Referenced by output().
|
inline |
Returns if this return code is not kErrorCodeOk.
Definition at line 56 of file fixed_error_stack.hpp.
References foedus::kErrorCodeOk.
Referenced by output(), and to_error_stack().
FixedErrorStack & foedus::FixedErrorStack::operator= | ( | const ErrorStack & | src | ) |
Assignment operator.
Definition at line 27 of file fixed_error_stack.cpp.
References foedus::assorted::FixedString< MAXLEN, CHAR >::assign(), foedus::assorted::FixedString< MAXLEN, CHAR >::clear(), foedus::ErrorStack::get_custom_message(), foedus::ErrorStack::get_error_code(), foedus::ErrorStack::get_filename(), foedus::ErrorStack::get_func(), foedus::ErrorStack::get_linenum(), foedus::ErrorStack::get_os_errno(), foedus::ErrorStack::get_stack_depth(), foedus::ErrorStack::is_error(), and foedus::kErrorCodeOk.
Referenced by FixedErrorStack().
void foedus::FixedErrorStack::output | ( | std::ostream * | ptr | ) | const |
Describe this object to the given stream.
Definition at line 50 of file fixed_error_stack.cpp.
References get_custom_message(), foedus::get_error_name(), get_filename(), get_func(), get_linenum(), get_message(), get_stack_depth(), is_error(), foedus::ErrorStack::kMaxStackDepth, and foedus::assorted::os_error().
Referenced by foedus::operator<<(), and to_error_stack().
ErrorStack foedus::FixedErrorStack::to_error_stack | ( | ) | const |
Instantiates an ErrorStack object based on this object.
We can't generate a completely same object (ErrorStack needs const char* pointers), so we put much of information as custom error message.
Definition at line 76 of file fixed_error_stack.cpp.
References ERROR_STACK_MSG, is_error(), foedus::kRetOk, and output().
Referenced by foedus::thread::ImpersonateSession::get_result().
|
friend |
Definition at line 106 of file fixed_error_stack.cpp.