Skip to content

Fix publish #19

@kayodebristol

Description

@kayodebristol

The failure occurred in wasm/src/lib.rs at line 56 due to a panic caused by calling unwrap() on a Result that contained an Err value. The error originates from a JavaScript TypeError: Reflect.get called on non-object, which usually means that a non-object value was passed where an object was expected in your Rust <-> JS FFI boundary.

Solution:

  • Find the line in wasm/src/lib.rs corresponding to unwrap() (around line 56) and replace it with proper error handling. For example:
// Replace:
let my_value = maybe_value.unwrap();

// With:
let my_value = match maybe_value {
    Ok(val) => val,
    Err(e) => {
        // consider logging or returning a Rust error instead of panicking
        return Err(format!("JS call failed: {:?}", e));
    }
};
  • Ensure any JS objects passed via wasm-bindgen or other FFI interfaces are actually JS objects, not primitives or undefined.
  • Check that all use of Reflect.get or .get() in JS or Rust bindings are supplied with valid JS objects.

Follow the ref de82d3f to verify the fix in the corresponding code. This should prevent panics and provide more robust error reporting.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions