This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Windows: include syscall in fs errors

  • Loading branch information...
1 parent daaccc7 commit 3733a85d8d1fa82ca9998fd874f16084801d5db5 @piscisaureus piscisaureus committed Mar 7, 2012
Showing with 17 additions and 4 deletions.
  1. +17 −4 src/node_file.cc
View
@@ -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); \

0 comments on commit 3733a85

Please sign in to comment.