Add trace log in error case