src: add error_msg to create pretty pcsc errors

This commit is contained in:
Santiago Gimeno
2014-09-23 11:26:38 +02:00
parent ec0b79562c
commit f85250beb0
3 changed files with 27 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
#include "pcsclite.h"
#include "common.h"
using namespace v8;
using namespace node;
@@ -28,7 +29,7 @@ PCSCLite::PCSCLite(): m_card_context(NULL),
NULL,
&m_card_context);
if (result != SCARD_S_SUCCESS) {
NanThrowError(pcsc_stringify_error(result));
NanThrowError(error_msg("SCardEstablishContext", result).c_str());
}
}
@@ -102,7 +103,7 @@ void PCSCLite::HandleReaderStatusChange(uv_async_t *handle, int status) {
NanCallback(NanNew(async_baton->callback)).Call(argc, argv);
} else {
Local<Value> err = NanError(pcsc_stringify_error(ar->result));
Local<Value> err = NanError(error_msg("SCardListReaders", ar->result).c_str());
// Prepare the parameters for the callback function.
const unsigned argc = 1;
Handle<Value> argv[argc] = { err };