Michael Hansen
10 years ago
4 changed files with 42 additions and 10 deletions
@ -0,0 +1,25 @@
|
||||
#include "hsExceptions.h" |
||||
|
||||
#include <cstring> |
||||
|
||||
const char *hsException::what() const HS_NOEXCEPT |
||||
{ |
||||
char buffer[64]; |
||||
|
||||
static const char *kErrorNames[] = { |
||||
"kNo_hsError", |
||||
"kNilParam_hsError", |
||||
"kBadParam_hsError", |
||||
"kInternal_hsError", |
||||
"kOS_hsError" |
||||
}; |
||||
static_assert(arrsize(kErrorNames) == hsErrorEnum_MAX, |
||||
"kErrorNames not in sync with hsErrorEnum"); |
||||
|
||||
if (fError >= 0 && fError < hsErrorEnum_MAX) |
||||
snprintf(buffer, arrsize(buffer), "%s (%ld)", kErrorNames[fError], fParam); |
||||
else |
||||
snprintf(buffer, arrsize(buffer), "Unknown hsException error %d (%ld)", fError, fParam); |
||||
|
||||
return buffer; |
||||
} |
Loading…
Reference in new issue