Browse Source

src: node.cc use isolate->ThrowException

Environment doesn't have ThrowException, we meant isolate here.

Introduced in commit
75adde07f9.
v0.11.12-release
Alexis Campailla 11 years ago
committed by Timothy J Fontaine
parent
commit
440b9e2245
  1. 51
      src/node.cc

51
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, int errorno,
const char* syscall, const char* syscall,
const char* msg, const char* msg,
const char* path) { const char* path) {
Environment* env = Environment::GetCurrent(isolate);
Local<Value> e; Local<Value> e;
if (!msg || !msg[0]) { if (!msg || !msg[0]) {
msg = winapi_strerror(errorno); msg = winapi_strerror(errorno);
@ -823,38 +824,29 @@ Local<Value> WinapiErrnoException(Environment* env,
if (path) { if (path) {
Local<String> cons1 = Local<String> cons1 =
String::Concat(message, FIXED_ONE_BYTE_STRING(env->isolate(), " '")); String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '"));
Local<String> cons2 = Local<String> cons2 =
String::Concat(cons1, String::NewFromUtf8(env->isolate(), path)); String::Concat(cons1, String::NewFromUtf8(isolate, path));
Local<String> cons3 = Local<String> cons3 =
String::Concat(cons2, FIXED_ONE_BYTE_STRING(env->isolate(), "'")); String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'"));
e = Exception::Error(cons3); e = Exception::Error(cons3);
} else { } else {
e = Exception::Error(message); e = Exception::Error(message);
} }
Local<Object> obj = e->ToObject(); 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) { 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) { if (syscall != NULL) {
obj->Set(env->syscall_string(), OneByteString(env->isolate(), syscall)); obj->Set(env->syscall_string(), OneByteString(isolate, syscall));
} }
return e; 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 #endif
@ -3188,8 +3180,9 @@ static int RegisterDebugSignalHandler() {
static void DebugProcess(const FunctionCallbackInfo<Value>& args) { static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args.GetIsolate()); Isolate* isolate = args.GetIsolate();
HandleScope scope(env->isolate()); Environment* env = Environment::GetCurrent(isolate);
HandleScope scope(isolate);
DWORD pid; DWORD pid;
HANDLE process = NULL; HANDLE process = NULL;
HANDLE thread = NULL; HANDLE thread = NULL;
@ -3210,8 +3203,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
FALSE, FALSE,
pid); pid);
if (process == NULL) { if (process == NULL) {
env->ThrowException( isolate->ThrowException(
WinapiErrnoException(env, GetLastError(), "OpenProcess")); WinapiErrnoException(isolate, GetLastError(), "OpenProcess"));
goto out; goto out;
} }
@ -3224,7 +3217,7 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mapping_name); mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mapping_name);
if (mapping == NULL) { if (mapping == NULL) {
env->ThrowException(WinapiErrnoException(env, isolate->ThrowException(WinapiErrnoException(isolate,
GetLastError(), GetLastError(),
"OpenFileMappingW")); "OpenFileMappingW"));
goto out; goto out;
@ -3237,8 +3230,8 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
0, 0,
sizeof *handler)); sizeof *handler));
if (handler == NULL || *handler == NULL) { if (handler == NULL || *handler == NULL) {
env->ThrowException( isolate->ThrowException(
WinapiErrnoException(env, GetLastError(), "MapViewOfFile")); WinapiErrnoException(isolate, GetLastError(), "MapViewOfFile"));
goto out; goto out;
} }
@ -3250,17 +3243,17 @@ static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
0, 0,
NULL); NULL);
if (thread == NULL) { if (thread == NULL) {
env->ThrowException(WinapiErrnoException(env, isolate->ThrowException(WinapiErrnoException(isolate,
GetLastError(), GetLastError(),
"CreateRemoteThread")); "CreateRemoteThread"));
goto out; goto out;
} }
// Wait for the thread to terminate // Wait for the thread to terminate
if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) { if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) {
env->ThrowException(WinapiErrnoException(env, isolate->ThrowException(WinapiErrnoException(isolate,
GetLastError(), GetLastError(),
"WaitForSingleObject")); "WaitForSingleObject"));
goto out; goto out;
} }

Loading…
Cancel
Save