Add try catch in code for log an exeption