Js exception handler api