Add and catch exceptions for js failures.