소스 검색

report all instead of first error up the acquire chain

If we don't give a specific error to report up it is likely that all
error currently in the error stack are equally important, so reporting
just one could turn out to be confusing e.g. if name resolution failed
in a SRV record list.
David Kalnischkies 10 년 전
부모
커밋
b50dfa6b2d
2개의 변경된 파일21개의 추가작업 그리고 4개의 파일을 삭제
  1. 14 3
      apt-pkg/acquire-method.cc
  2. 7 1
      methods/https.cc

+ 14 - 3
apt-pkg/acquire-method.cc

@@ -80,9 +80,20 @@ void pkgAcqMethod::Fail(bool Transient)
 {
    string Err = "Undetermined Error";
    if (_error->empty() == false)
-      _error->PopMessage(Err);   
-   _error->Discard();
-   Fail(Err,Transient);
+   {
+      Err.clear();
+      while (_error->empty() == false)
+      {
+	 std::string msg;
+	 if (_error->PopMessage(msg))
+	 {
+	    if (Err.empty() == false)
+	       Err.append("\n");
+	    Err.append(msg);
+	 }
+      }
+   }
+   Fail(Err, Transient);
 }
 									/*}}}*/
 // AcqMethod::Fail - A fetch has failed					/*{{{*/

+ 7 - 1
methods/https.cc

@@ -436,7 +436,13 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
 	    break;
       }
 #pragma GCC diagnostic pop
-      return _error->Error("%s", curl_errorstr);
+      // only take curls technical errors if we haven't our own
+      // (e.g. for the maximum size limit we have and curls can be confusing)
+      if (_error->PendingError() == false)
+	 _error->Error("%s", curl_errorstr);
+      else
+	 _error->Warning("curl: %s", curl_errorstr);
+      return false;
    }
 
    // server says file not modified