fix try/catch logic and added log