Print builder errors by default.

This commit is contained in:
Corentin Wallez 2017-05-10 15:07:36 +02:00 committed by Corentin Wallez
parent cd0ea35889
commit f79df0c62d
1 changed files with 10 additions and 1 deletions

View File

@ -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;