How log error/exception of JS to native iOS swift?

I want to capture JS errors to the native swift, So my goal is when I run my application on DEBUG mode I want to notify the developer via native alert or any other UI component when any error/exception occurs on JS. Is there any way I can achieve this? overriding onError or injecting any script?

1 Like