wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Catch syntax errors in constructors of `js_sys::Function`

Open s9ferech opened this issue 4 years ago • 3 comments

This is a potential solution to issue #2496.

The constructors new_with_args and new_no_args will catch exceptions that are caused by syntax errors or similar problem.

This change would require to add an explicit unwrap in all places where the constructors are already used.

s9ferech avatar Mar 17 '21 16:03 s9ferech

Thanks! Since this is a breaking change it can't land yet, but I'll tag it.

alexcrichton avatar Mar 17 '21 19:03 alexcrichton

@alexcrichton are there any plans to merge it one day? Or at least we can add another constructor next to existing one?

wdanilo avatar Feb 25 '22 22:02 wdanilo

As mentioned this is a breaking change, and no there is no plans of when a breaking change will land. Adding new constructors is fine.

alexcrichton avatar Feb 28 '22 17:02 alexcrichton