Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Windows: include syscall in fs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Mar 8, 2012
1 parent daaccc7 commit 3733a85
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/node_file.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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); \
Expand Down

0 comments on commit 3733a85

Please sign in to comment.