Skip to content

Commit

Permalink
src: add THROW_ERR_* helpers
Browse files Browse the repository at this point in the history
PR-URL: #20121
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
joyeecheung authored and jasnell committed Apr 19, 2018
1 parent beaa7bb commit c218854
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace node {
e->Set(isolate->GetCurrentContext(), OneByteString(isolate, "code"), \
js_code).FromJust(); \
return e; \
} \
inline void THROW_ ## code(Environment* env, const char* message) { \
env->isolate()->ThrowException(code(env->isolate(), message)); \
}
ERRORS_WITH_CODE(V)
#undef V
Expand All @@ -44,6 +47,9 @@ namespace node {
#define V(code, message) \
inline v8::Local<v8::Value> code(v8::Isolate* isolate) { \
return code(isolate, message); \
} \
inline void THROW_ ## code(Environment* env) { \
env->isolate()->ThrowException(code(env->isolate(), message)); \
}
PREDEFINED_ERROR_MESSAGES(V)
#undef V
Expand Down

0 comments on commit c218854

Please sign in to comment.