diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2014-02-21 17:02:42 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-02-22 03:20:56 +0400 |
commit | 75adde07f9a2de7f38a67bec72bd377d450bdb52 (patch) | |
tree | f93e9faebbe53c44c6806c9d52ae539a95fe58d5 /src/env-inl.h | |
parent | e746bbdc2b79881b2c991c829b5437340583a064 (diff) | |
download | node-new-75adde07f9a2de7f38a67bec72bd377d450bdb52.tar.gz |
src: remove `node_isolate` from source
fix #6899
Diffstat (limited to 'src/env-inl.h')
-rw-r--r-- | src/env-inl.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/env-inl.h b/src/env-inl.h index 7d0a9ddb4e..bcc7995fa3 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -23,6 +23,7 @@ #define SRC_ENV_INL_H_ #include "env.h" +#include "node.h" #include "util.h" #include "util-inl.h" #include "uv.h" @@ -364,6 +365,57 @@ inline Environment::IsolateData* Environment::isolate_data() const { return isolate_data_; } +// this would have been a template function were it not for the fact that g++ +// sometimes fails to resolve it... +#define THROW_ERROR(fun) \ + do { \ + v8::HandleScope scope(isolate); \ + v8::ThrowException(fun(OneByteString(isolate, errmsg))); \ + } \ + while (0) + +inline void Environment::ThrowError(v8::Isolate* isolate, const char* errmsg) { + THROW_ERROR(v8::Exception::Error); +} + +inline void Environment::ThrowTypeError(v8::Isolate* isolate, + const char* errmsg) { + THROW_ERROR(v8::Exception::TypeError); +} + +inline void Environment::ThrowRangeError(v8::Isolate* isolate, + const char* errmsg) { + THROW_ERROR(v8::Exception::RangeError); +} + +inline void Environment::ThrowError(const char* errmsg) { + ThrowError(isolate(), errmsg); +} + +inline void Environment::ThrowTypeError(const char* errmsg) { + ThrowTypeError(isolate(), errmsg); +} + +inline void Environment::ThrowRangeError(const char* errmsg) { + ThrowRangeError(isolate(), errmsg); +} + +inline void Environment::ThrowErrnoException(int errorno, + const char* syscall, + const char* message, + const char* path) { + v8::ThrowException( + ErrnoException(isolate(), errorno, syscall, message, path)); +} + +inline void Environment::ThrowUVException(int errorno, + const char* syscall, + const char* message, + const char* path) { + v8::ThrowException( + UVException(isolate(), errorno, syscall, message, path)); +} + #define V(PropertyName, StringValue) \ inline \ v8::Local<v8::String> Environment::IsolateData::PropertyName() const { \ |