Replace most invocations of fail keyword with die! macro
This commit is contained in:
parent
2db3175c76
commit
aee7929469
331 changed files with 914 additions and 908 deletions
|
@ -64,14 +64,14 @@ pub fn format_addr(ip: &IpAddr) -> ~str {
|
|||
Ipv4(ref addr) => unsafe {
|
||||
let result = uv_ip4_name(addr);
|
||||
if result == ~"" {
|
||||
fail ~"failed to convert inner sockaddr_in address to str"
|
||||
die!(~"failed to convert inner sockaddr_in address to str")
|
||||
}
|
||||
result
|
||||
},
|
||||
Ipv6(ref addr) => unsafe {
|
||||
let result = uv_ip6_name(addr);
|
||||
if result == ~"" {
|
||||
fail ~"failed to convert inner sockaddr_in address to str"
|
||||
die!(~"failed to convert inner sockaddr_in address to str")
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ pub mod v4 {
|
|||
pub fn parse_addr(ip: &str) -> IpAddr {
|
||||
match try_parse_addr(ip) {
|
||||
result::Ok(move addr) => move addr,
|
||||
result::Err(ref err_data) => fail err_data.err_msg
|
||||
result::Err(ref err_data) => die!(err_data.err_msg)
|
||||
}
|
||||
}
|
||||
// the simple, old style numberic representation of
|
||||
|
@ -278,7 +278,7 @@ pub mod v6 {
|
|||
pub fn parse_addr(ip: &str) -> IpAddr {
|
||||
match try_parse_addr(ip) {
|
||||
result::Ok(move addr) => move addr,
|
||||
result::Err(copy err_data) => fail err_data.err_msg
|
||||
result::Err(copy err_data) => die!(err_data.err_msg)
|
||||
}
|
||||
}
|
||||
pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
|
||||
|
@ -400,7 +400,7 @@ mod test {
|
|||
assert true;
|
||||
}
|
||||
result::Ok(ref addr) => {
|
||||
fail fmt!("Expected failure, but got addr %?", addr);
|
||||
die!(fmt!("Expected failure, but got addr %?", addr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ mod test {
|
|||
assert true;
|
||||
}
|
||||
result::Ok(ref addr) => {
|
||||
fail fmt!("Expected failure, but got addr %?", addr);
|
||||
die!(fmt!("Expected failure, but got addr %?", addr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ mod test {
|
|||
let iotask = &uv::global_loop::get();
|
||||
let ga_result = get_addr(localhost_name, iotask);
|
||||
if result::is_err(&ga_result) {
|
||||
fail ~"got err result from net::ip::get_addr();"
|
||||
die!(~"got err result from net::ip::get_addr();")
|
||||
}
|
||||
// note really sure how to realiably test/assert
|
||||
// this.. mostly just wanting to see it work, atm.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue