summaryrefslogtreecommitdiff
path: root/src/node.cc
diff options
context:
space:
mode:
authorAlexis Campailla <alexis@janeasystems.com>2014-02-24 10:55:27 -0800
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-02-24 11:54:22 -0800
commit440b9e2245740af0168cf27c1af6bc681bbe5754 (patch)
tree81347acca3fce55f1946234786eafa8c717e8d54 /src/node.cc
parentaf1418325bac37f70b57580eec98ee211e11c2dd (diff)
downloadnode-new-440b9e2245740af0168cf27c1af6bc681bbe5754.tar.gz
src: node.cc use isolate->ThrowException
Environment doesn't have ThrowException, we meant isolate here. Introduced in commit 75adde07f9a2de7f38a67bec72bd377d450bdb52.
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/node.cc b/src/node.cc
index 7c0bb33926..f9ffdcfa6f 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -810,11 +810,12 @@ static const char *winapi_strerror(const int errorno) {
}
-Local<Value> WinapiErrnoException(Environment* env,
+Local<Value> WinapiErrnoException(Isolate* isolate,
int errorno,
const char* syscall,
const char* msg,
const char* path) {
+ Environment* env = Environment::GetCurrent(isolate);
Local<Value> e;
if (!msg || !msg[0]) {
msg = winapi_strerror(errorno);
@@ -823,38 +824,29 @@ Local<Value> WinapiErrnoException(Environment* env,
if (path) {
Local<String> cons1 =
- String::Concat(message, FIXED_ONE_BYTE_STRING(env->isolate(), " '"));
+ String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '"));
Local<String> cons2 =
- String::Concat(cons1, String::NewFromUtf8(env->isolate(), path));
+ String::Concat(cons1, String::NewFromUtf8(isolate, path));
Local<String> cons3 =
- String::Concat(cons2, FIXED_ONE_BYTE_STRING(env->isolate(), "'"));
+ String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'"));
e = Exception::Error(cons3);
} else {
e = Exception::Error(message);
}
Local<Object> obj = e->ToObject();
- obj->Set(env->errno_string(), Integer::New(errorno, env->isolate()));
+ obj->Set(env->errno_string(), Integer::New(errorno, isolate));
if (path != NULL) {
- obj->Set(env->path_string(), String::NewFromUtf8(env->isolate(), path));
+ obj->Set(env->path_string(), String::NewFromUtf8(isolate, path));
}
if (syscall != NULL) {
- obj->Set(env->syscall_string(), OneByteString(env->isolate(), syscall));
+ obj->Set(env->syscall_string(), OneByteString(isolate, syscall));
}
return e;
}
-
-
-Local<Value> WinapiErrnoException(int errorno,
- const char* syscall,
- const char* msg,
- const char* path) {
- Environment* env = Environment::GetCurrent(Isolate::GetCurrent());
- return WinapiErrnoException(env, errorno, syscall, msg, path);
-}
#endif
@@ -3188,8 +3180,9 @@ static int RegisterDebugSignalHandler() {
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args.GetIsolate());
- HandleScope scope(env->isolate());
+ Isolate* isolate = args.GetIsolate();
+ Environment* env = Environment::GetCurrent(isolate);
+ HandleScope scope(isolate);
DWORD pid;
HANDLE process = NULL;
HANDLE thread = NULL;
@@ -3210,8 +3203,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
FALSE,
pid);
if (process == NULL) {
- env->ThrowException(
- WinapiErrnoException(env, GetLastError(), "OpenProcess"));
+ isolate->ThrowException(
+ WinapiErrnoException(isolate, GetLastError(), "OpenProcess"));
goto out;
}
@@ -3224,7 +3217,7 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mapping_name);
if (mapping == NULL) {
- env->ThrowException(WinapiErrnoException(env,
+ isolate->ThrowException(WinapiErrnoException(isolate,
GetLastError(),
"OpenFileMappingW"));
goto out;
@@ -3237,8 +3230,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
0,
sizeof *handler));
if (handler == NULL || *handler == NULL) {
- env->ThrowException(
- WinapiErrnoException(env, GetLastError(), "MapViewOfFile"));
+ isolate->ThrowException(
+ WinapiErrnoException(isolate, GetLastError(), "MapViewOfFile"));
goto out;
}
@@ -3250,17 +3243,17 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
0,
NULL);
if (thread == NULL) {
- env->ThrowException(WinapiErrnoException(env,
- GetLastError(),
- "CreateRemoteThread"));
+ isolate->ThrowException(WinapiErrnoException(isolate,
+ GetLastError(),
+ "CreateRemoteThread"));
goto out;
}
// Wait for the thread to terminate
if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) {
- env->ThrowException(WinapiErrnoException(env,
- GetLastError(),
- "WaitForSingleObject"));
+ isolate->ThrowException(WinapiErrnoException(isolate,
+ GetLastError(),
+ "WaitForSingleObject"));
goto out;
}