/** * WosServerException constructor. * * @param string $code * @param string $message * @param \Exception $previous */ public function __construct($code, $message = '', \Exception $previous = null) { // If we get a '0' from the server, and we throw this exception, then // something is wrong in this codebase. if ($code == 0) { throw new \LogicException('0 DDN code is not an error code (it is the success code)'); } // Automatically set message if not specified if (!$message) { $message = array_key_exists($code, static::$codeMeanings) ? static::$codeMeanings[$code] : static::UNKNOWN_MEANING; } parent::__construct($message, $code, $previous); }
/** * InvalidResponseException constructor. * * @param string $oarameterName The parameter/HTTP header that was expected in the response (e.g. 'x-ddn-oid') * @param string $requestAction The action that was requested, if known (e.g., 'getMetdata()') */ public function __construct($oarameterName, $requestAction = '') { $this->parameterName = $oarameterName; $message = sprintf("Response did not contain '%s' header. Are you sure that you made a %s to a WOS Server?", $oarameterName, $requestAction ? $requestAction . ' request' : 'request'); parent::__construct($message); }