mirror of https://github.com/nodejs/node.git
process: improve process binding
Reviewed-By: Fedor Indutny <fedor@indutny.com>archived-io.js-v0.10
parent
47a103a029
commit
962e651476
|
@ -2240,7 +2240,12 @@ static void Binding(const FunctionCallbackInfo<Value>& args) {
|
|||
DefineJavaScript(env, exports);
|
||||
cache->Set(module, exports);
|
||||
} else {
|
||||
return env->ThrowError("No such module");
|
||||
char errmsg[1024];
|
||||
snprintf(errmsg,
|
||||
sizeof(errmsg),
|
||||
"No such module: %s",
|
||||
*module_v);
|
||||
return env->ThrowError(errmsg);
|
||||
}
|
||||
|
||||
args.GetReturnValue().Set(exports);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
var assert = require('assert');
|
||||
|
||||
assert.throws(
|
||||
function() {
|
||||
process.binding('test');
|
||||
},
|
||||
/No such module: test/
|
||||
);
|
||||
|
||||
assert.doesNotThrow(function () {
|
||||
process.binding('buffer');
|
||||
}, function(err) {
|
||||
if ( (err instanceof Error) ) {
|
||||
return true;
|
||||
}
|
||||
}, "unexpected error");
|
Loading…
Reference in New Issue