17 template <
size_t maxMsgSize, const
char * defaultMessage>
30 if (i_format == NULL) {
31 strncpy(msg, defaultMessage, maxMsgSize - 1);
35 va_start(args, i_format);
36 formatTo(maxMsgSize, msg, i_format, args);
39 msg[maxMsgSize - 1] =
'\0';
45 const char *
what(
void)
const noexcept {
return msg; }
70 const char *
ellipt(
const std::string & i_src) {
return elliptString(i_src.c_str(), maxItemSize, msgItem); }
73 static const size_t maxItemSize = 40;
74 char msgItem[maxItemSize + 1];
openM++ exceptions
Definition: omError.h:19
OpenmException(const char *i_format,...)
create openM++ exception.
Definition: omError.h:27
const char * what(void) const noexcept
return error message
Definition: omError.h:45
openM++ namespace
Definition: log.h:32
const char * elliptString(const char *i_src, size_t i_size, char *io_buffer)
if source string exceed max size than return ellipted copy into the buffer
Definition: helper.cpp:440
const char helperUnknownErrorMessage[]
helper library exception default error message: "unknown error in helper method"
Definition: log.cpp:22
void formatTo(size_t i_size, char *io_buffer, const char *i_format, va_list io_args)
format message into supplied buffer using vsnprintf()
Definition: helper.cpp:406
OpenmException< 4000, helperUnknownErrorMessage > HelperException
helper library exception
Definition: omError.h:55
OpenM++ common helper utilities.
helper to return ellipted string if source string exceed max size.
Definition: omError.h:61
const char * ellipt(const std::string &i_src)
if source string exceed max size than return ellipted copy.
Definition: omError.h:70
const char * ellipt(const char *i_src)
if source string exceed max size than return ellipted copy.
Definition: omError.h:65