Browse Source

Better error reporting

Nathaniel van Diepen 6 years ago
parent
commit
b7d2a37e41
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Net/socket.class.php

+ 2 - 2
Net/socket.class.php

@@ -73,15 +73,15 @@
 			if($this->socket_type == static::SERVER){
 				if(is_null($this->port)){
 					$res = socket_bind($this->socket, $this->address);
+					$this->throw_if($res);
 					if(!file_exists($this->address)){
 						throw new \Exception('Unable to create socket file');
 					}
 					chmod($this->address, 0702);
 					unlink($this->address); // Delete when we are done
 				}else{
-					$res = socket_bind($this->socket, $this->address, $this->port);
+					$this->throw_if(socket_bind($this->socket, $this->address, $this->port));
 				}
-				$this->throw_if($res);
 				$this->fire('bind', $this);
 				$this->throw_if(socket_listen($this->socket, $this->max_connections));
 				$this->fire('listen', $this);