Add logs in case of exception in Jajascript