Replace most of the JError with try catch