@@ -115,14 +115,15 @@ @throw [OFInvalidPortException newWithObject: self]; if (sock >= 0) @throw [OFAlreadyConnectedException newWithObject: self]; - if ((sock = socket(family, SOCK_STREAM, 0)) < 0) { - /* FIXME: Throw exception */ - return nil; - } + if ((sock = socket(family, SOCK_STREAM, 0)) < 0) + @throw [OFBindFailedException newWithObject: self + andHost: host + andPort: port + andFamily: family]; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; @@ -133,13 +134,15 @@ newWithObject: self andNode: host andService: portstr]; if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { - /* FIXME: Throw exception */ freeaddrinfo(res); - return nil; + @throw [OFBindFailedException newWithObject: self + andHost: host + andPort: port + andFamily: family]; } freeaddrinfo(res); return self;