Commit 630240ef authored by Ximin Luo's avatar Ximin Luo

Imported Upstream version 2.0.8

parent 8d7c5d5c
language: node_js
- linux
- osx
sudo: false
language: cpp
- ubuntu-toolchain-r-test
- g++-4.8
# - NODE_WEBKIT="0.11.6" NODE_VERSION="0.11.13"
- "0.10"
- rm -rf ~/.nvm && git clone ~/.nvm && source ~/.nvm/ && nvm install $TRAVIS_NODE_VERSION
- npm install npm
- mv node_modules npm
- npm/.bin/npm --version
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi
- $CXX --version
- npm/.bin/npm install
- rm -rf ~/.nvm
- git clone ~/.nvm
- source ~/.nvm/
- nvm install $NODE_VERSION
- node --version
- if [[ ${NODE_VERSION} == "0.8" ]]; then node_modules/.bin/node-gyp rebuild --directory test; else node_modules/.bin/pangyp rebuild --directory test; fi
# - if [[ ${NODE_WEBKIT:-unset} != "unset" ]]; then npm install nw-gyp && ./node_modules/.bin/nw-gyp rebuild --directory test --target=$NODE_WEBKIT; fi
script: tap --gc test/js/*-test.js
- if [[ $TRAVIS_NODE_VERSION == "0.8" ]]; then node_modules/.bin/node-gyp rebuild --directory test; else node_modules/.bin/pangyp rebuild --directory test; fi
script: node_modules/.bin/tap --gc test/js/*-test.js
# NAN ChangeLog
**Version 1.8.4: current Node 12: 0.12.2, Node 10: 0.10.38, io.js: 1.8.1**
**Version 2.0.8: current Node 12: 0.12.7, Node 10: 0.10.40, io.js: 3.2.0**
### 2.0.8 Aug 28 2015
- Work around duplicate linking bug in clang 11902da
### 2.0.7 Aug 26 2015
- Build: Repackage
### 2.0.6 Aug 26 2015
- Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1
- Bugfix: Remove unused static std::map instances 525bddc
- Bugfix: Make better use of maybe versions of APIs bfba85b
- Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d
### 2.0.5 Aug 10 2015
- Bugfix: Reimplement weak callback in ObjectWrap 98d38c1
- Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d
### 2.0.4 Aug 6 2015
- Build: Repackage
### 2.0.3 Aug 6 2015
- Bugfix: Don't use clang++ / g++ syntax extension. 231450e
### 2.0.2 Aug 6 2015
- Build: Repackage
### 2.0.1 Aug 6 2015
- Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687
- Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601
- Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f
- Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed
### 2.0.0 Jul 31 2015
- Change: Renamed identifiers with leading underscores b5932b4
- Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1
- Change: Replace NanScope and NanEscpableScope macros with classes 47751c4
- Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99
- Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5
- Change: Rename NanNewBuffer to NanCopyBuffer d6af78d
- Change: Remove Nan prefix from all names 72d1f67
- Change: Update Buffer API for new upstream changes d5d3291
- Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a
- Change: Get rid of Handles e6c0daf
- Feature: Support io.js 3 with V8 4.4
- Feature: Introduce NanPersistent 7fed696
- Feature: Introduce NanGlobal 4408da1
- Feature: Added NanTryCatch 10f1ca4
- Feature: Update for V8 v4.3 4b6404a
- Feature: Introduce NanNewOneByteString c543d32
- Feature: Introduce namespace Nan 67ed1b1
- Removal: Remove NanLocker and NanUnlocker dd6e401
- Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9
- Removal: Remove NanReturn* macros d90a25c
- Removal: Remove HasInstance e8f84fe
### 1.9.0 Jul 31 2015
- Feature: Added `NanFatalException` 81d4a2c
- Feature: Added more error types 4265f06
- Feature: Added dereference and function call operators to NanCallback c4b2ed0
- Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c
- Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6
- Feature: Added NanErrnoException dd87d9e
- Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130
- Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c
- Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b
### 1.8.4 Apr 26 2015
......@@ -4,7 +4,7 @@ The MIT License (MIT)
Copyright (c) 2015 NAN contributors
*NAN contributors listed at <>*
*NAN contributors listed at <>*
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......@@ -2,7 +2,7 @@ TOPLEVEL ?= $(dir $(lastword $(MAKEFILE_LIST)))
PYTHON ?= python
BUILDTYPE ?= Release
MODULES = symbols strings optionvalues
MODULES = symbols strings
SOURCES = $(MODULES:%=test/cpp/%.cpp)
ADDONS = $(MODULES:%=test/build/$(BUILDTYPE)/%.node)
......@@ -15,33 +15,59 @@ LINT_SOURCES = \
examples/async_pi_estimate/ \
examples/async_pi_estimate/sync.h \
nan.h \
nan_string_bytes.h \
nan_callbacks.h \
nan_callbacks_12_inl.h \
nan_callbacks_pre_12_inl.h \
nan_converters.h \
nan_converters_43_inl.h \
nan_converters_pre_43_inl.h \
nan_implementation_12_inl.h \
nan_implementation_pre_12_inl.h \
nan_maybe_43_inl.h \
nan_maybe_pre_43_inl.h \
nan_new.h \
nan_object_wrap.h \
nan_persistent_12_inl.h \
nan_persistent_pre_12_inl.h \
nan_string_bytes.h \
nan_weak.h \
test/cpp/accessors.cpp \
test/cpp/accessors2.cpp \
test/cpp/asyncworker.cpp \
test/cpp/asyncprogressworker.cpp \
test/cpp/asyncworkererror.cpp \
test/cpp/bufferworkerpersistent.cpp \
test/cpp/gc.cpp \
test/cpp/morenews.cpp \
test/cpp/asyncprogressworker.cpp \
test/cpp/asyncworkererror.cpp \
test/cpp/buffer.cpp \
test/cpp/bufferworkerpersistent.cpp \
test/cpp/error.cpp \
test/cpp/gc.cpp \
test/cpp/indexedinterceptors.cpp \
test/cpp/isolatedata.cpp \
test/cpp/makecallback.cpp \
test/cpp/morenews.cpp \
test/cpp/converters.cpp \
test/cpp/isolatedata.cpp \
test/cpp/makecallback.cpp \
test/cpp/morenews.cpp \
test/cpp/multifile1.cpp \
test/cpp/multifile2.cpp \
test/cpp/multifile2.h \
test/cpp/namedinterceptors.cpp \
test/cpp/nancallback.cpp \
test/cpp/nannew.cpp \
test/cpp/news.cpp \
test/cpp/news.cpp \
test/cpp/objectwraphandle.cpp \
test/cpp/optionvalues.cpp \
test/cpp/persistent.cpp \
test/cpp/returnemptystring.cpp \
test/cpp/returnnull.cpp \
test/cpp/returnundefined.cpp \
test/cpp/returnvalue.cpp \
test/cpp/settergetter.cpp \
test/cpp/settemplate.cpp \
test/cpp/strings.cpp \
test/cpp/symbols.cpp \
test/cpp/weak.cpp \
test/cpp/threadlocal.cpp \
test/cpp/trycatch.cpp \
test/cpp/weak.cpp \
test/cpp/weak2.cpp \
FILTER = -whitespace/parens
......@@ -58,5 +84,17 @@ forcetest:
cd test/ && node-gyp rebuild && cd ..
npm test
$(ADDONS): nan.h nan_string_bytes.h nan_new.h nan_implementation_pre_12_inl.h nan_implementation_12_inl.h test/binding.gyp $(SOURCES)
docs: doc/ doc/ doc/ doc/ \
doc/ doc/ doc/ doc/ doc/ \
doc/ doc/ doc/ doc/ doc/ \
doc/ doc/
$(ADDONS): nan.h nan_new.h nan_implementation_pre_12_inl.h nan_implementation_12_inl.h \
nan_callbacks.h nan_callbacks_12_inl.h nan_callbacks_pre_12_inl.h \
nan_converters.h nan_converters_43_inl.h nan_converters_pre_43_inl.h \
nan_maybe_43_inl.h nan_maybe_pre_43_inl.h \
nan_persistent_12_inl.h nan_persistent_pre_12_inl.h nan_weak.h \
nan_string_bytes.h test/binding.gyp $(SOURCES)
cd test/ && ../node_modules/.bin/node-gyp rebuild
This diff is collapsed.
......@@ -9,18 +9,19 @@ environment:
- nodejs_version: "0.12"
# io.js
- nodejs_version: "1"
- nodejs_version: "2"
- nodejs_version: "3"
# Install scripts. (runs after repo cloning)
# Get the latest stable version of Node 0.STABLE.latest
- ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version}
- ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)}
- IF NOT %nodejs_version% == 1 npm -g install npm
- IF NOT %nodejs_version% == 1 set PATH=%APPDATA%\npm;%PATH%
- IF %nodejs_version% LSS 1 npm -g install npm
- IF %nodejs_version% LSS 1 set PATH=%APPDATA%\npm;%PATH%
# Typical npm stuff.
- npm install
- IF %nodejs_version% == 0.8 node node_modules\node-gyp\bin\node-gyp.js rebuild --directory test
- IF NOT %nodejs_version% == 0.8 npm run rebuild-tests
- IF %nodejs_version% EQU 0.8 (node node_modules\node-gyp\bin\node-gyp.js rebuild --msvs_version=2013 --directory test) ELSE (npm run rebuild-tests)
# Post-install test scripts.
......@@ -28,8 +29,7 @@ test_script:
- node --version
- npm --version
# run tests
- IF NOT %nodejs_version% == 1 npm test
- IF %nodejs_version% == 1 iojs node_modules\tap\bin\tap.js --gc test\js\*-test.js
- IF %nodejs_version% LSS 1 (npm test) ELSE (iojs node_modules\tap\bin\tap.js --gc test/js/*-test.js)
# Don't actually build.
build: off
#!/usr/bin/env bash
files=" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
__dirname=$(dirname "${BASH_SOURCE[0]}")
head=$(perl -e 'while (<>) { if (!$en){print;} if ($_=~/<!-- START/){$en=1} };' $__dirname/../
tail=$(perl -e 'while (<>) { if ($_=~/<!-- END/){$st=1} if ($st){print;} };' $__dirname/../
apidocs=$(for f in $files; do
perl -pe '
last if /^<a name/;
$_ =~ s/^## /### /;
$_ =~ s/<a href="#/<a href="doc\/'$f'#/;
' $__dirname/$f;
cat > $__dirname/../ << EOF
\ No newline at end of file
## Asynchronous work helpers
`Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier.
- <a href="#api_nan_async_worker"><b><code>Nan::AsyncWorker</code></b></a>
- <a href="#api_nan_async_progress_worker"><b><code>Nan::AsyncProgressWorker</code></b></a>
- <a href="#api_nan_async_queue_worker"><b><code>Nan::AsyncQueueWorker</code></b></a>
<a name="api_nan_async_worker"></a>
### Nan::AsyncWorker
`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress.
class AsyncWorker {
explicit AsyncWorker(Callback *callback_);
virtual ~AsyncWorker();
virtual void WorkComplete();
void SaveToPersistent(const char *key, const v8::Local<v8::Value> &value);
void SaveToPersistent(const v8::Local<v8::String> &key,
const v8::Local<v8::Value> &value);
void SaveToPersistent(uint32_t index,
const v8::Local<v8::Value> &value);
v8::Local<v8::Value> GetFromPersistent(const char *key) const;
v8::Local<v8::Value> GetFromPersistent(const v8::Local<v8::String> &key) const;
v8::Local<v8::Value> GetFromPersistent(uint32_t index) const;
virtual void Execute() = 0;
uv_work_t request;
virtual void Destroy();
Persistent<v8::Object> persistentHandle;
Callback *callback;
virtual void HandleOKCallback();
virtual void HandleErrorCallback();
void SetErrorMessage(const char *msg);
const char* ErrorMessage();
<a name="api_nan_async_progress_worker"></a>
### Nan::AsyncProgressWorker
`Nan::AsyncProgressWorker` is an _abstract_ class that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript.
class AsyncProgressWorker : public AsyncWorker {
explicit AsyncProgressWorker(Callback *callback_);
virtual ~AsyncProgressWorker();
void WorkProgress();
class ExecutionProgress {
void Send(const char* data, size_t size) const;
virtual void Execute(const ExecutionProgress& progress) = 0;
virtual void HandleProgressCallback(const char *data, size_t size) = 0;
virtual void Destroy();
<a name="api_nan_async_queue_worker"></a>
### Nan::AsyncQueueWorker
`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`.
void AsyncQueueWorker(AsyncWorker *);
## Buffers
NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility.
- <a href="#api_nan_new_buffer"><b><code>Nan::NewBuffer()</code></b></a>
- <a href="#api_nan_copy_buffer"><b><code>Nan::CopyBuffer()</code></b></a>
<a name="api_nan_new_buffer"></a>
### Nan::NewBuffer()
Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`.
Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management.
When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`.
You _must not_ free the memory space manually once you have created a `Buffer` in this way.
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(uint32_t size)
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char* data, uint32_t size)
// uses `node::smalloc::FreeCallback` on older versions of Node
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char *data,
size_t length,
node::Buffer::FreeCallback callback,
void *hint)
<a name="api_nan_copy_buffer"></a>
### Nan::CopyBuffer()
Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`.
Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy.
Nan::MaybeLocal<v8::Object> Nan::CopyBuffer(const char *data, uint32_t size)
## Nan::Callback
`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution.
- <a href="#api_nan_callback"><b><code>Nan::Callback</code></b></a>
<a name="api_nan_callback"></a>
### Nan::Callback
class Callback {
explicit Callback(const v8::Local<v8::Function> &fn);
bool operator==(const Callback &other) const;
bool operator!=(const Callback &other) const;
v8::Local<v8::Function> operator*() const;
v8::Local<v8::Value> operator()(v8::Local<v8::Object> target,
int argc = 0,
v8::Local<v8::Value> argv[] = 0) const;
v8::Local<v8::Value> operator()(int argc = 0,
v8::Local<v8::Value> argv[] = 0) const;
void SetFunction(const v8::Local<v8::Function> &fn);
v8::Local<v8::Function> GetFunction() const;
bool IsEmpty() const;
v8::Local<v8::Value> Call(v8::Local<v8::Object> target,
int argc,
v8::Local<v8::Value> argv[]) const;
v8::Local<v8::Value> Call(int argc, v8::Local<v8::Value> argv[]) const;
Example usage:
v8::Local<v8::Function> function;
Nan::Callback callback(function);
callback->Call(0, 0);
## Converters
NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN.
- <a href="#api_nan_to"><b><code>Nan::To()</code></b></a>
<a name="api_nan_to"></a>
### Nan::To()
Converts a `v8::Local<v8::Value>` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly.
See [](./ for more information on `Nan::Maybe` types.
// V8 types
Nan::MaybeLocal<v8::Boolean> Nan::To<v8::Boolean>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::Int32> Nan::To<v8::Int32>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::Integer> Nan::To<v8::Integer>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::Object> Nan::To<v8::Object>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::Number> Nan::To<v8::Number>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::String> Nan::To<v8::String>(v8::Local<v8::Value> val);
Nan::MaybeLocal<v8::Uint32> Nan::To<v8::Uint32>(v8::Local<v8::Value> val);
// Native types
Nan::Maybe<bool> Nan::To<bool>(v8::Local<v8::Value> val);
Nan::Maybe<double> Nan::To<double>(v8::Local<v8::Value> val);
Nan::Maybe<int32_t> Nan::To<int32_t>(v8::Local<v8::Value> val);
Nan::Maybe<int64_t> Nan::To<int64_t>(v8::Local<v8::Value> val);
Nan::Maybe<uint32_t> Nan::To<uint32_t>(v8::Local<v8::Value> val);
### Example
v8::Local<v8::Value> val;
Nan::MaybeLocal<v8::String> str = Nan::To<v8::String>(val);
Nan::Maybe<double> d = Nan::To<double>(val);
## Errors
NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted.
Note that an Error object is simply a specialized form of `v8::Value`.
Also consult the V8 Embedders Guide section on [Exceptions]( for more information.
- <a href="#api_nan_error"><b><code>Nan::Error()</code></b></a>
- <a href="#api_nan_range_error"><b><code>Nan::RangeError()</code></b></a>
- <a href="#api_nan_reference_error"><b><code>Nan::ReferenceError()</code></b></a>
- <a href="#api_nan_syntax_error"><b><code>Nan::SyntaxError()</code></b></a>
- <a href="#api_nan_type_error"><b><code>Nan::TypeError()</code></b></a>
- <a href="#api_nan_throw_error"><b><code>Nan::ThrowError()</code></b></a>
- <a href="#api_nan_throw_range_error"><b><code>Nan::ThrowRangeError()</code></b></a>
- <a href="#api_nan_throw_reference_error"><b><code>Nan::ThrowReferenceError()</code></b></a>
- <a href="#api_nan_throw_syntax_error"><b><code>Nan::ThrowSyntaxError()</code></b></a>
- <a href="#api_nan_throw_type_error"><b><code>Nan::ThrowTypeError()</code></b></a>
- <a href="#api_nan_fatal_exception"><b><code>Nan::FatalException()</code></b></a>
- <a href="#api_nan_errno_exception"><b><code>Nan::ErrnoException()</code></b></a>
- <a href="#api_nan_try_catch"><b><code>Nan::TryCatch</code></b></a>
<a name="api_nan_error"></a>
### Nan::Error()
Create a new Error object using the [v8::Exception]( class in a way that is compatible across the supported versions of V8.
Note that an Error object is simply a specialized form of `v8::Value`.
v8::Local<v8::Value> Nan::Error(const char *msg);
v8::Local<v8::Value> Nan::Error(v8::Local<v8::String> msg);
<a name="api_nan_range_error"></a>
### Nan::RangeError()
Create a new RangeError object using the [v8::Exception]( class in a way that is compatible across the supported versions of V8.
Note that an RangeError object is simply a specialized form of `v8::Value`.
v8::Local<v8::Value> Nan::RangeError(const char *msg);
v8::Local<v8::Value> Nan::RangeError(v8::Local<v8::String> msg);
<a name="api_nan_reference_error"></a>
### Nan::ReferenceError()
Create a new ReferenceError object using the [v8::Exception]( class in a way that is compatible across the supported versions of V8.
Note that an ReferenceError object is simply a specialized form of `v8::Value`.
v8::Local<v8::Value> Nan::ReferenceError(const char *msg);
v8::Local<v8::Value> Nan::ReferenceError(v8::Local<v8::String> msg);
<a name="api_nan_syntax_error"></a>
### Nan::SyntaxError()
Create a new SyntaxError object using the [v8::Exception]( class in a way that is compatible across the supported versions of V8.
Note that an SyntaxError object is simply a specialized form of `v8::Value`.
v8::Local<v8::Value> Nan::SyntaxError(const char *msg);
v8::Local<v8::Value> Nan::SyntaxError(v8::Local<v8::String> msg);
<a name="api_nan_type_error"></a>
### Nan::TypeError()
Create a new TypeError object using the [v8::Exception]( class in a way that is compatible across the supported versions of V8.
Note that an TypeError object is simply a specialized form of `v8::Value`.
v8::Local<v8::Value> Nan::TypeError(const char *msg);
v8::Local<v8::Value> Nan::TypeError(v8::Local<v8::String> msg);
<a name="api_nan_throw_error"></a>
### Nan::ThrowError()
Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created.
void Nan::ThrowError(const char *msg);
void Nan::ThrowError(v8::Local<v8::String> msg);
void Nan::ThrowError(v8::Local<v8::Value> error);
<a name="api_nan_throw_range_error"></a>
### Nan::ThrowRangeError()
Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created.
void Nan::ThrowRangeError(const char *msg);
void Nan::ThrowRangeError(v8::Local<v8::String> msg);
void Nan::ThrowRangeError(v8::Local<v8::Value> error);
<a name="api_nan_throw_reference_error"></a>
### Nan::ThrowReferenceError()
Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created.
void Nan::ThrowReferenceError(const char *msg);
void Nan::ThrowReferenceError(v8::Local<v8::String> msg);
void Nan::ThrowReferenceError(v8::Local<v8::Value> error);
<a name="api_nan_throw_syntax_error"></a>
### Nan::ThrowSyntaxError()
Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created.