Refactor ExceptionHandler logic
Change error handling of untrusted certificate