relative to `process.cwd()`.
Most fs functions let you omit the callback argument. If you do, a default
-callback is used that ignores errors, but prints a deprecation
-warning.
-
-**IMPORTANT**: Omitting the callback is deprecated. v0.12 will throw the
-errors as exceptions.
+callback is used that rethrows errors. To get a trace to the original call
+site, set the NODE_DEBUG environment variable:
+
+ $ cat script.js
+ function bad() {
+ require('fs').readFile('/');
+ }
+ bad();
+
+ $ env NODE_DEBUG=fs node script.js
+ fs.js:66
+ throw err;
+ ^
+ Error: EISDIR, read
+ at rethrow (fs.js:61:21)
+ at maybeCallback (fs.js:79:42)
+ at Object.fs.readFile (fs.js:153:18)
+ at bad (/path/to/script.js:2:17)
+ at Object.<anonymous> (/path/to/script.js:5:1)
+ <etc.>
- ## fs.rename(oldPath, newPath, [callback])
+ ## fs.rename(oldPath, newPath, callback)
Asynchronous rename(2). No arguments other than a possible exception are given
to the completion callback.
if (try_catch.HasCaught()) {
FatalException(try_catch);
- return Undefined();
+ return Undefined(node_isolate);
}
- return scope.Close(ret);
+ return ret;
+ }
+
+
+ Handle<Value>
+ MakeCallback(const Handle<Object> object,
+ const Handle<String> symbol,
+ int argc,
+ Handle<Value> argv[]) {
- HandleScope scope;
++ HandleScope scope(node_isolate);
+
+ Local<Function> callback = object->Get(symbol).As<Function>();
+ Local<Value> domain = object->Get(domain_symbol);
+
+ // has domain, off with you
+ if (!domain->IsNull() && !domain->IsUndefined())
+ return scope.Close(MakeDomainCallback(object, callback, argc, argv));
+ return scope.Close(MakeCallback(object, callback, argc, argv));
}
#endif
+ Handle<Value> TCPWrap::Open(const Arguments& args) {
+ HandleScope scope;
+ UNWRAP(TCPWrap)
+ int fd = args[0]->IntegerValue();
+ uv_tcp_open(&wrap->handle_, fd);
+ return Null();
+ }
+
+
Handle<Value> TCPWrap::Bind(const Arguments& args) {
- HandleScope scope;
+ HandleScope scope(node_isolate);
UNWRAP(TCPWrap)