| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e6eb5c0 commit 95c8df1
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + #include <node.h> | ||
| 2 | + #include <v8.h> | ||
| 3 | + | ||
| 4 | + void Method(const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
| 5 | + v8::Isolate* isolate = args.GetIsolate(); | ||
| 6 | + v8::HandleScope scope(isolate); | ||
| 7 | + args.GetReturnValue().Set(node::ErrnoException(isolate, | ||
| 8 | + 10, | ||
| 9 | + "syscall", | ||
| 10 | + "some error msg", | ||
| 11 | + "päth")); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + void init(v8::Local<v8::Object> exports) { | ||
| 15 | + NODE_SET_METHOD(exports, "errno", Method); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + NODE_MODULE(binding, init) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + { | ||
| 2 | + 'targets': [ | ||
| 3 | + { | ||
| 4 | + 'target_name': 'binding', | ||
| 5 | + 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], | ||
| 6 | + 'sources': [ 'binding.cc' ] | ||
| 7 | + } | ||
| 8 | + ] | ||
| 9 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../../common'); | ||
| 4 | + | ||
| 5 | + // Verify that the path argument to node::ErrnoException() can contain UTF-8 | ||
| 6 | + // characters. | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const binding = require(`./build/${common.buildType}/binding`); | ||
| 10 | + const err = binding.errno(); | ||
| 11 | + | ||
| 12 | + assert.strictEqual(err.syscall, 'syscall'); | ||
| 13 | + assert.strictEqual(err.errno, 10); | ||
| 14 | + assert.strictEqual(err.path, 'päth'); | ||
| 15 | + assert.ok(/^Error:\s\w+, some error msg 'päth'$/.test(err.toString())); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments