diff options
author | Bert Belder <bertbelder@gmail.com> | 2012-03-08 00:13:44 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-03-08 02:57:44 +0100 |
commit | 3733a85d8d1fa82ca9998fd874f16084801d5db5 (patch) | |
tree | f14be36e2fcf3fbbeceb294f818e9139cb2b0f1d /src | |
parent | daaccc7cb7f4ac208146ef3940fe61c3080fbc16 (diff) | |
download | node-3733a85d8d1fa82ca9998fd874f16084801d5db5.tar.gz |
Windows: include syscall in fs errors
Diffstat (limited to 'src')
-rw-r--r-- | src/node_file.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/node_file.cc b/src/node_file.cc index 5e0c0ad04..645f44532 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<uv_fs_t> FSReqWrap; +class FSReqWrap: public ReqWrap<uv_fs_t> { + public: + FSReqWrap(const char* syscall) + : syscall_(syscall) { + } + + const char* syscall() { return syscall_; } + + private: + const char* syscall_; +}; + static Persistent<String> encoding_symbol; static Persistent<String> 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<const char*>(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); \ |