diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-06-02 21:55:19 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-06-02 21:55:19 -0400 |
commit | 0b058f570e71a3eaa1314a947fdff3d88193a63f (patch) | |
tree | 0bcb7d79e68722c9a63501e6f2fe478aae9d37cf /src/common.rs | |
parent | c98d8a044308e3cde1de4945dbb7f5ee62ab52a5 (diff) | |
download | ucp-0b058f570e71a3eaa1314a947fdff3d88193a63f.tar.gz ucp-0b058f570e71a3eaa1314a947fdff3d88193a63f.zip |
more improvements to error handling
Diffstat (limited to 'src/common.rs')
-rw-r--r-- | src/common.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common.rs b/src/common.rs index 77b28ce..9aa477f 100644 --- a/src/common.rs +++ b/src/common.rs @@ -31,7 +31,7 @@ pub fn source_files<S: Read + Write>(stream: &mut S, file_path: &str, recursive: 1 | 2 => { // Warning unimplemented!(); }, - _ => { panic!("Unexpected status char!") }, + _ => { return Err("Unexpected status char!".to_string()); }, }; let mut buf = [0; 4096]; @@ -52,7 +52,7 @@ pub fn source_files<S: Read + Write>(stream: &mut S, file_path: &str, recursive: 1 | 2 => { // Warning unimplemented!(); }, - _ => { panic!("Unexpected status char!") }, + _ => { return Err("Unexpected status char!".to_string()) }, }; Ok(()) } @@ -89,7 +89,7 @@ pub fn sink_files<S: Read + Write>(stream: &mut S, file_path: &str, recursive: b 'D' => { unimplemented!(); }, 'E' => { unimplemented!(); }, 'T' => { unimplemented!(); }, - _ => { panic!(format!("Unexpected message type: {}", msg_type)); }, + _ => { return Err(format!("Unexpected message type: {}", msg_type)); }, }; let line = raw_read_line(stream).unwrap(); println!("got msg: {}", line); |