Created
March 7, 2012 23:14
-
-
Save piscisaureus/1997086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8d938b2de6ecb291713ddf6ee4f79e9e0c871b93 Mon Sep 17 00:00:00 2001 | |
From: Bert Belder <[email protected]> | |
Date: Thu, 8 Mar 2012 00:13:44 +0100 | |
Subject: [PATCH 1/1] Windows: include syscall in fs errors | |
--- | |
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 3a9877e..fe5529d 100644 | |
--- a/src/node_file.cc | |
+++ b/src/node_file.cc | |
@@ -51,7 +51,18 @@ using namespace v8; | |
#define THROW_BAD_ARGS TYPE_ERROR("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; | |
@@ -88,11 +99,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 { | |
@@ -208,7 +221,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); \ | |
req_wrap->object_->Set(oncomplete_sym, callback); \ | |
-- | |
1.7.7.1.msysgit.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment