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/node_internals.h | |
parent | e746bbdc2b79881b2c991c829b5437340583a064 (diff) | |
download | node-new-75adde07f9a2de7f38a67bec72bd377d450bdb52.tar.gz |
src: remove `node_isolate` from source
fix #6899
Diffstat (limited to 'src/node_internals.h')
-rw-r--r-- | src/node_internals.h | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/src/node_internals.h b/src/node_internals.h index efd45c4857..1b5914443d 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -22,6 +22,7 @@ #ifndef SRC_NODE_INTERNALS_H_ #define SRC_NODE_INTERNALS_H_ +#include "node.h" #include "env.h" #include "util.h" #include "util-inl.h" @@ -36,9 +37,6 @@ struct sockaddr; namespace node { -// Defined in node.cc -extern v8::Isolate* node_isolate; - // If persistent.IsWeak() == false, then do not call persistent.Dispose() // while the returned Local<T> is still in scope, it will destroy the // reference to the object. @@ -120,41 +118,6 @@ inline static int snprintf(char* buf, unsigned int len, const char* fmt, ...) { # define NO_RETURN #endif -// 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(node_isolate); \ - v8::ThrowException(fun(OneByteString(node_isolate, errmsg))); \ - } \ - while (0) - -inline static void ThrowError(const char* errmsg) { - THROW_ERROR(v8::Exception::Error); -} - -inline static void ThrowTypeError(const char* errmsg) { - THROW_ERROR(v8::Exception::TypeError); -} - -inline static void ThrowRangeError(const char* errmsg) { - THROW_ERROR(v8::Exception::RangeError); -} - -inline static void ThrowErrnoException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL) { - v8::ThrowException(ErrnoException(errorno, syscall, message, path)); -} - -inline static void ThrowUVException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL) { - v8::ThrowException(UVException(errorno, syscall, message, path)); -} - void AppendExceptionLine(Environment* env, v8::Handle<v8::Value> er, v8::Handle<v8::Message> message); @@ -205,6 +168,38 @@ inline MUST_USE_RESULT bool ParseArrayIndex(v8::Handle<v8::Value> arg, return true; } +NODE_DEPRECATED("Use env->ThrowError()", + inline void ThrowError(const char* errmsg) { + Environment* env = Environment::GetCurrent(v8::Isolate::GetCurrent()); + return env->ThrowError(errmsg); +}) +NODE_DEPRECATED("Use env->ThrowTypeError()", + inline void ThrowTypeError(const char* errmsg) { + Environment* env = Environment::GetCurrent(v8::Isolate::GetCurrent()); + return env->ThrowTypeError(errmsg); +}) +NODE_DEPRECATED("Use env->ThrowRangeError()", + inline void ThrowRangeError(const char* errmsg) { + Environment* env = Environment::GetCurrent(v8::Isolate::GetCurrent()); + return env->ThrowRangeError(errmsg); +}) +NODE_DEPRECATED("Use env->ThrowErrnoException()", + inline void ThrowErrnoException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL) { + Environment* env = Environment::GetCurrent(v8::Isolate::GetCurrent()); + return env->ThrowErrnoException(errorno, syscall, message, path); +}) +NODE_DEPRECATED("Use env->ThrowUVException()", + inline void ThrowUVException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL) { + Environment* env = Environment::GetCurrent(v8::Isolate::GetCurrent()); + return env->ThrowUVException(errorno, syscall, message, path); +}) + } // namespace node #endif // SRC_NODE_INTERNALS_H_ |