Log error if it occurs