Skip to content

Improve Engine.check argument errors#660

Open
KirtiRamchandani wants to merge 1 commit into
brave:masterfrom
KirtiRamchandani:fix/js-binding-argument-errors
Open

Improve Engine.check argument errors#660
KirtiRamchandani wants to merge 1 commit into
brave:masterfrom
KirtiRamchandani:fix/js-binding-argument-errors

Conversation

@KirtiRamchandani

Copy link
Copy Markdown

Problem

  • Passing a non-string value to Engine.check currently surfaces Neon's generic downcast error, which does not identify which request argument is wrong.

Root cause

  • The binding layer directly downcasts the url, source_url, and request_type arguments without adding API-level context.

Solution

  • Add a small string argument helper that reports the expected argument name.
  • Use it for Engine.check request arguments.
  • Add JS binding coverage for invalid url, source_url, and request_type values.

Tests run

  • cargo fmt --all -- --check
  • cargo check -p adblock-rs
  • cargo test -p adblock --lib resources::resource_storage -- --nocapture
  • npm install --ignore-scripts
  • npm run build
  • npm run test:js
  • cargo test -p adblock-rs --no-default-features
  • git diff --check

Fixes #182

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.

Error handling for JS bindings

1 participant