You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "hsExceptions.h"
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
hsException::hsException(hsErrorEnum error, long param) HS_NOEXCEPT
|
|
|
|
: fError(error), fParam(param)
|
|
|
|
{
|
|
|
|
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(fWhat, arrsize(fWhat), "%s (%ld)", kErrorNames[fError], fParam);
|
|
|
|
else
|
|
|
|
snprintf(fWhat, arrsize(fWhat), "Unknown hsException error %d (%ld)", fError, fParam);
|
|
|
|
}
|