/** * Create a new instance with an error code provided by the sockets * extension or with the given message. * * @param int|string $errorCode The error code or message * @see socket_lasterror() * @see socket_strerror() */ public function __construct($errorCode) { if (is_string($errorCode)) { $errorMessage = $errorCode; $errorCode = null; } else { $this->errorCode = $errorCode; $errorMessage = socket_strerror($errorCode) . " (Code: {$errorCode})"; } parent::__construct($errorMessage, $errorCode); }
/** * Creates a new WebApiException with an error message according to the * given <var>$cause</var>. If this cause is <var>STATUS_BAD</var> (which * will origin from the Web API itself) or <var>HTTP_ERROR</var> the * details about this failed request will be taken from * <var>$statusCode</var> and <var>$statusMessage</var>. * * @param int $cause An integer indicating the problem which caused this * exception: * * <ul> * <li><var>HTTP_ERROR</var>: An error during the HTTP request * itself will result in an exception with this reason.</li> * <li><var>INVALID_KEY</var>: This occurs when trying to set a Web * API key that isn't valid, i.e. a 128 bit integer in a * hexadecimal string. * <li><var>STATUS_BAD</var>: This is caused by a successful request * that fails for some Web API internal reason (e.g. an invalid * argument). Details about this failed request will be taken * from <var>$statusCode</var> and <var>$statusMessage</var>. * <li><var>UNAUTHORIZED</var>: This happens when a Steam Web API * request is rejected as unauthorized. This most likely means * that you did not specify a valid Web API key using * {@link WebApi::setApiKey()}. A Web API key can be obtained * from http://steamcommunity.com/dev/apikey. * </ul> * * Other undefined reasons will cause a generic error message. * @param int $statusCode The HTTP status code returned by the Web API * @param string $statusMessage The status message returned in the response */ public function __construct($cause, $statusCode = null, $statusMessage = '') { switch ($cause) { case self::HTTP_ERROR: $message = "The Web API request has failed due to an HTTP error: {$statusMessage} (status code: {$statusCode})."; break; case self::INVALID_KEY: $message = 'This is not a valid Steam Web API key.'; break; case self::STATUS_BAD: $message = "The Web API request failed with the following error: {$statusMessage} (status code: {$statusCode})."; break; case self::UNAUTHORIZED: $message = 'Your Web API request has been rejected. You most likely did not specify a valid Web API key.'; break; default: $message = 'An unexpected error occurred while executing a Web API request.'; } parent::__construct($message); }
/** * Creates a new <var>RCONNoAuthException</var> instance */ public function __construct() { parent::__construct('Not authenticated yet.'); }
public function __construct() { parent::__construct('You have been banned from this server.'); }
/** * Creates a new <var>PacketFormatException</var> instance * * @param string $message The message to attach to the exception */ public function __construct($message = "The packet data received doesn't match the packet format.") { parent::__construct($message); }