enhance error logging