Add logging when error encountered