diff --git a/src/httpsys.cc b/src/httpsys.cc index 7c6a4fd..59c73ba 100644 --- a/src/httpsys.cc +++ b/src/httpsys.cc @@ -122,6 +122,13 @@ char* verbs[] = { "SEARCH" }; +const int LAST_ERROR_BUF_SIZE = 1024; +char lastCheckErrorBuf[LAST_ERROR_BUF_SIZE]; +void SetLastFromCheckError(long err, const char *file, int line) +{ + sprintf_s(lastCheckErrorBuf,LAST_ERROR_BUF_SIZE,"%s.%d Error Code: %i",file,line,err); +} + // Processing common to all callbacks from HTTP.SYS: // - map the uv_async_t handle to uv_httpsys_t // - decrement event loop reference count to indicate completion of async operation @@ -824,7 +831,7 @@ Handle httpsys_listen(const Arguments& args) uv_httpsys = NULL; } - return handleScope.Close(ThrowException(Int32::New(hr))); + return handleScope.Close(ThrowException(String::New(lastCheckErrorBuf))); } Handle httpsys_stop_listen(const Arguments& args) diff --git a/src/httpsys.h b/src/httpsys.h index 1981f6f..43acc4e 100644 --- a/src/httpsys.h +++ b/src/httpsys.h @@ -27,6 +27,7 @@ using namespace v8; if (S_OK != tmp_hr) \ { \ hr = tmp_hr; \ + SetLastFromCheckError(hr, __FILE__, __LINE__); \ goto Error; \ } \ }