try catch in getting error code message