Skip to content

fix: return clear errors instead of "Error in native callback" - #54

Open
YOU54F wants to merge 1 commit into
masterfrom
fix/wrap-ffi-errors
Open

YOU54F wants to merge 1 commit into
masterfrom
fix/wrap-ffi-errors

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Fixes pact-foundation#406. All 97 tests pass locally.

Commits

fix: return clear errors instead of "Error in native callback" (pact-foundation#406)

Some FFI methods that don't return a status were not wrapped, so a core
failure reached users as a generic "Error in native callback".

  • mismatches, message reify and log buffer return null from native code
    when the core returns NULL, and free the core's strings
  • mockServerMismatches and reifyMessage throw a clear error on null
  • message interaction methods are checked like the HTTP ones
  • errors reading verifier results reject the promise instead of being
    thrown from the native callback

Fixes pact-foundation#406

🤖 Generated with Claude Code

…foundation#406)

Some FFI methods that don't return a status were not wrapped, so a core
failure reached users as a generic "Error in native callback".

- mismatches, message reify and log buffer return null from native code
  when the core returns NULL, and free the core's strings
- mockServerMismatches and reifyMessage throw a clear error on null
- message interaction methods are checked like the HTTP ones
- errors reading verifier results reject the promise instead of being
  thrown from the native callback

Fixes pact-foundation#406

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Wrap all FFI methods that can crash

1 participant