Print builder errors by default.
This commit is contained in:
parent
cd0ea35889
commit
f79df0c62d
|
@ -29,6 +29,14 @@ namespace wire {
|
||||||
|
|
||||||
class Device;
|
class Device;
|
||||||
|
|
||||||
|
void PrintBuilderError(nxtBuilderErrorStatus status, const char* message, nxtCallbackUserdata, nxtCallbackUserdata) {
|
||||||
|
if (status == NXT_BUILDER_ERROR_STATUS_SUCCESS || status == NXT_BUILDER_ERROR_STATUS_UNKNOWN) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Got a builder error " << status << ": " << message << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
struct BuilderCallbackData {
|
struct BuilderCallbackData {
|
||||||
void Call(nxtBuilderErrorStatus status, const char* message) {
|
void Call(nxtBuilderErrorStatus status, const char* message) {
|
||||||
if (canCall && callback != nullptr) {
|
if (canCall && callback != nullptr) {
|
||||||
|
@ -37,7 +45,8 @@ namespace wire {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nxtBuilderErrorCallback callback = nullptr;
|
//* For help with development, prints all builder errors by default.
|
||||||
|
nxtBuilderErrorCallback callback = PrintBuilderError;
|
||||||
nxtCallbackUserdata userdata1 = 0;
|
nxtCallbackUserdata userdata1 = 0;
|
||||||
nxtCallbackUserdata userdata2 = 0;
|
nxtCallbackUserdata userdata2 = 0;
|
||||||
bool canCall = true;
|
bool canCall = true;
|
||||||
|
|
Loading…
Reference in New Issue