Skip to content

ffi: use type errors for invalid signatures - #66222

Open
HoonDongKang wants to merge 1 commit into
nodejs:mainfrom
HoonDongKang:ffi-change-type-errors
Open

HoonDongKang wants to merge 1 commit into
nodejs:mainfrom
HoonDongKang:ffi-change-type-errors

Conversation

@HoonDongKang

Copy link
Copy Markdown
Contributor

Summary

ParseFunctionSignature() reports ERR_INVALID_ARG_VALUE when signature properties have incorrect JS types.

- THROW_ERR_INVALID_ARG_VALUE()
+ THROW_ERR_INVALID_ARG_TYPE()

Use ERR_INVALID_ARG_TYPE when:

  • return is not a string.
  • arguments is not an array.
  • An element of the arguments array is not a string.

Testing

make -j4
./node --test test/ffi/test-ffi-dynamic-library.js

ℹ tests 18
ℹ suites 0
ℹ pass 18
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 140.289875

Signed-off-by: HoonDongKang <d159123@naver.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.28%. Comparing base (3d85c94) to head (c44f0f6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66222      +/-   ##
==========================================
- Coverage   90.29%   90.28%   -0.01%     
==========================================
  Files         790      790              
  Lines      272880   272880              
  Branches    52103    52104       +1     
==========================================
- Hits       246385   246377       -8     
- Misses      16936    16970      +34     
+ Partials     9559     9533      -26     
Files with missing lines Coverage Δ
src/ffi/types.cc 56.07% <100.00%> (+2.35%) ⬆️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daeyeon daeyeon added the ffi Issues and PRs related to experimental Foreign Function Interface support. label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants