From 3733a85d8d1fa82ca9998fd874f16084801d5db5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 8 Mar 2012 00:13:44 +0100 Subject: [PATCH] Windows: include syscall in fs errors --- src/node_file.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 5e0c0ad048..645f44532b 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -49,7 +49,18 @@ using namespace v8; #define THROW_BAD_ARGS \ ThrowException(Exception::TypeError(String::New("Bad argument"))) -typedef class ReqWrap FSReqWrap; +class FSReqWrap: public ReqWrap { + public: + FSReqWrap(const char* syscall) + : syscall_(syscall) { + } + + const char* syscall() { return syscall_; } + + private: + const char* syscall_; +}; + static Persistent encoding_symbol; static Persistent errno_symbol; @@ -86,11 +97,13 @@ static void After(uv_fs_t *req) { // If the request doesn't have a path parameter set. if (!req->path) { - argv[0] = UVException(req->errorno); - } else { argv[0] = UVException(req->errorno, NULL, + req_wrap->syscall()); + } else { + argv[0] = UVException(req->errorno, NULL, + req_wrap->syscall(), static_cast(req->path)); } } else { @@ -206,7 +219,7 @@ struct fs_req_wrap { #define ASYNC_CALL(func, callback, ...) \ - FSReqWrap* req_wrap = new FSReqWrap(); \ + FSReqWrap* req_wrap = new FSReqWrap(#func); \ int r = uv_fs_##func(uv_default_loop(), &req_wrap->req_, \ __VA_ARGS__, After); \ assert(r == 0); \