Add additional diagnostic logging when errors happen