20 #include <glog/logging.h>
31 custom_message_.
clear();
40 for (uint16_t i = 0; i < stack_depth_; ++i) {
51 std::ostream &o = *ptr;
63 for (uint16_t stack_index = 0; stack_index <
get_stack_depth(); ++stack_index) {
66 if (!
get_func(stack_index).empty()) {
71 o << std::endl <<
" .. and more. Increase kMaxStackDepth to see full stacktraces";
80 std::stringstream msg;
94 custom_message_.
clear();
98 for (uint16_t i = 0; i < stack_depth_; ++i) {
const FixedFuncName & get_func(uint16_t stack_index) const
Returns the function name of the given stack position.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint16_t get_stack_depth() const
Returns the depth of stack this error code has collected.
Brings error stacktrace information as return value of functions.
const char * get_error_name(ErrorCode code)
Returns the names of ErrorCode enum defined in error_code.xmacro.
std::ostream & operator<<(std::ostream &o, const Epoch &v)
bool is_error() const
Returns if this return code is not kErrorCodeOk.
const char * get_filename(uint16_t stack_index) const
Returns the file name of the given stack position.
ErrorCode get_error_code() const
Return the integer error code.
FixedErrorStack & operator=(const ErrorStack &src)
Assignment operator.
void assign(const FixedString< MAXLEN2, CHAR > &other) noexcept
Assign operator for all FixedString objects.
ErrorStack to_error_stack() const
Instantiates an ErrorStack object based on this object.
void output(std::ostream *ptr) const
Describe this object to the given stream.
Maximum stack trace depth.
const char * get_message() const
Returns the error message inferred by the error code.
uint16_t get_stack_depth() const
Returns the depth of stack this error code has collected.
Representation of ErrorStack that can be copied to other processes and even serialized to files...
uint32_t get_linenum(uint16_t stack_index) const
Returns the line number of the given stack position.
const char * get_custom_message() const
Returns the custom error message.
std::string os_error()
Thread-safe strerror(errno).
const char * get_func(uint16_t stack_index) const
Returns the function name of the given stack position.
const FixedFileName & get_filename(uint16_t stack_index) const
Returns the file name of the given stack position.
const ErrorStack kRetOk
Normal return value for no-error case.
uint32_t get_linenum(uint16_t stack_index) const
Returns the line number of the given stack position.
#define ERROR_STACK_MSG(e, m)
Overload of ERROR_STACK(e) to receive a custom error message.
void clear() noexcept
Clear string.
int get_os_errno() const
Global errno of the system as of instantiation of this error stack.
const FixedErrorMessage & get_custom_message() const
Returns the custom error message.
void from_error_stack(const ErrorStack &other)
Convert ErrorStack to this object.
bool is_error() const
Returns if this return code is not kErrorCodeOk.