Skip to content

chore(napi): display the real info for TypedArray#2310

Merged
Brooooooklyn merged 1 commit into
napi-rs:mainfrom
richerfu:main
Oct 15, 2024
Merged

chore(napi): display the real info for TypedArray#2310
Brooooooklyn merged 1 commit into
napi-rs:mainfrom
richerfu:main

Conversation

@richerfu
Copy link
Copy Markdown
Contributor

When we use Uint8Array in rust and pass into a Uint16Array, it will throw error info:

Error: Expected $name, got 4
    at Object.<anonymous> (/Users/ranger/Desktop/project/test/napi-test/test.js:11:11)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'InvalidArg'
}

It should be Error: Expected Uint8Array, got Uint16Array

@richerfu richerfu changed the title pref(napi): display the real info for TypedArray perf(napi): display the real info for TypedArray Oct 14, 2024
@Brooooooklyn Brooooooklyn changed the title perf(napi): display the real info for TypedArray chore(napi): display the real info for TypedArray Oct 15, 2024
@Brooooooklyn Brooooooklyn merged commit 7ed5972 into napi-rs:main Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants