Skip to content
Browse files

Proper exception thrown when can't bind

  • Loading branch information...
1 parent f55214f commit cf127a85efabf3e417e2914c1027883afd885e5e @shevron committed Mar 21, 2009
Showing with 6 additions and 1 deletion.
  1. +6 −1 library/Aspamia/Http/Server.php
View
7 library/Aspamia/Http/Server.php
@@ -82,9 +82,14 @@ public function run()
$this->_context = stream_context_create();
}
+ $errno = 0;
+ $errstr = null;
$this->_socket = stream_socket_server($addr, $errno, $errstr, $flags, $this->_context);
if (! $this->_socket) {
- return false;
+ require_once 'Aspamia/Http/Server/Exception.php';
+ $message = "Unable to bind to '$addr'";
+ if ($errno || $errstr) $message .= ": [#$errno] $errstr";
+ throw new Aspamia_Http_Server_Exception($message);
}
while(true) {

0 comments on commit cf127a8

Please sign in to comment.
Something went wrong with that request. Please try again.