servo: Merge #17835 - Make network error messages more specific (from KiChjang:clearer-network-error); r=emilio
authorKeith Yeung <kungfukeith11@gmail.com>
Mon, 24 Jul 2017 03:07:26 -0700
changeset 370563 e4d183f4d9bab9b7073f420e4b4b1333569f22cd
parent 370562 01e0c8b8e58176a94c6a66375c485caa5411d085
child 370564 54deee11a7c5711db2233653a7ce899d0dca5b64
push id32227
push userkwierso@gmail.com
push dateTue, 25 Jul 2017 00:58:03 +0000
treeherdermozilla-central@f6528783c525 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17835 - Make network error messages more specific (from KiChjang:clearer-network-error); r=emilio Instead of having a bogus "Network error" string, we extract the NetworkError struct from the Response and send it back to FetchResponseListener. Source-Repo: https://github.com/servo/servo Source-Revision: a56bd4663b30e3a5722d095b412b4340cf695cac
servo/components/net_traits/lib.rs
--- a/servo/components/net_traits/lib.rs
+++ b/servo/components/net_traits/lib.rs
@@ -223,20 +223,18 @@ impl FetchTaskTarget for IpcSender<Fetch
         let _ = self.send(FetchResponseMsg::ProcessResponse(response.metadata()));
     }
 
     fn process_response_chunk(&mut self, chunk: Vec<u8>) {
         let _ = self.send(FetchResponseMsg::ProcessResponseChunk(chunk));
     }
 
     fn process_response_eof(&mut self, response: &Response) {
-        if response.is_network_error() {
-            // todo: finer grained errors
-            let _ =
-                self.send(FetchResponseMsg::ProcessResponseEOF(Err(NetworkError::Internal("Network error".into()))));
+        if let Some(e) = response.get_network_error() {
+            let _ = self.send(FetchResponseMsg::ProcessResponseEOF(Err(e.clone())));
         } else {
             let _ = self.send(FetchResponseMsg::ProcessResponseEOF(Ok(())));
         }
     }
 }
 
 
 pub trait Action<Listener> {