public function __construct($msg = null, $code = 500) { if ($msg === null) { $msg = _('Password hashing failed.'); } parent::__construct($msg, $code); }
/** * constructor * * @param User $user User that's missing a profile */ public function __construct($user) { $this->user = $user; // TRANS: Exception text shown when no profile can be found for a user. // TRANS: %1$s is a user nickname, $2$d is a user ID (number). $message = sprintf(_("User %1{$s} (%2{$d}) has no profile record."), $user->nickname, $user->id); parent::__construct($message); }
public function __construct($msg = null) { if ($msg === null) { // TRANS: Exception text when attempting to perform something which seems already done. $msg = _('Trying to do something that was already done.'); } parent::__construct($msg, 409); }
public function __construct($profile_id, $msg = null) { $this->profile_id = $profile_id; if ($msg === null) { // TRANS: Exception text shown when no profile can be found for a user. // TRANS: %u is a profile ID (number). $msg = sprintf(_('There is no profile with id==%u'), $this->profile_id); } parent::__construct($msg, 404); }
/** * constructor * * @param array $data User_group search criteria */ public function __construct(array $data) { // filter on unique keys for User_group entries foreach (array('id', 'profile_id') as $key) { if (isset($data[$key]) && !empty($data[$key])) { $this->data[$key] = $data[$key]; } } // Here we could log the failed lookup parent::__construct(_('No such group found.')); }
/** * constructor * * @param array $data user search criteria */ public function __construct(array $data) { // filter on unique keys for local users foreach (array('id', 'email', 'nickname') as $key) { if (isset($data[$key]) && !empty($data[$key])) { $this->data[$key] = $data[$key]; } } // Here we could log the failed lookup parent::__construct(_('No such user found.')); }
public function __construct($object_uri, $msg = null) { $this->object_uri = $object_uri; if ($msg === null) { // TRANS: Exception text shown when no object found with certain URI // TRANS: %s is the URI. $msg = sprintf(_('No object found with URI "%s"'), $this->object_uri); common_debug(__CLASS__ . ': ' . $msg); } parent::__construct($msg, 404); }
public function __construct($code, $message, $previous = null) { parent::__construct($code, $message, $previous); }
public function __construct(Managed_DataObject $object) { $this->object = $object; $msg = get_class($object) . ' does not have a URI.'; parent::__construct($msg); }
public function __construct($called_class) { parent::__construct(sprintf(_('Empty ID value was given to query for a "%s" object'), $called_class)); }
public function __construct($method) { parent::__construct(sprintf(_('Method %s not implemented'), $method)); }
/** * constructor * * @param User $user User that's missing a profile */ public function __construct($user) { $this->user = $user; $message = sprintf(_("User %s (%d) has no profile record."), $user->nickname, $user->id); parent::__construct($message); }
/** * Parse the response return the body values as an assoc array * * @throws Exception * * @param HttpResponse $response - the response as supplied by the server * * @return HttpResponse */ public function parseResponse(HttpResponse $response) { $httpCode = $response->getHttpCode(); if ($httpCode < 200 || $httpCode >= 400) { // failure on server $body = $response->getBody(); if ($body != '') { // check if we can find details in the response body $details = json_decode($body, true); if (is_array($details) && isset($details["errorMessage"])) { // yes, we got details $exception = new ServerException($details["errorMessage"], $details["code"]); $exception->setDetails($details); throw $exception; } } // no details found, throw normal exception throw new ServerException($response->getResult(), $httpCode); } return $response; }
public function __construct(Profile $target) { $this->target = $target; // We could log an entry here with the search parameters parent::__construct(_('WebFinger URI generation failed.')); }
public function __construct(Memcached_DataObject $obj) { $this->obj = $obj; // We could log an entry here with the search parameters parent::__construct(sprintf(_('No result found on %s lookup.'), get_class($obj))); }
public function __construct($path) { $this->path = $path; parent::__construct(_('File not found in filesystem.'), 404); }
function __construct(Server $server) { parent::__construct($server, 'Cant listen socket'); }
public function __construct($msg, $path = null) { //common_debug(sprintf('UnsupportedMediaException "%1$s". File path (if given): "%2$s"', $msg, $path)); parent::__construct($msg); }
/** * Shutdown handler. */ public function shutdownHandler() { $error = error_get_last(); if ($error !== null) { $exception = $this->displayErrors ? ServerException::fromError($error['type'], 0, $error['message'], $error['file'], $error['line']) : new ServerException(JsonRpcException::CODE_INTERNAL_ERROR); throw $exception; } }
public function __construct() { parent::__construct(_('Opportunistic queue manager is out of work (no more items).')); }
function __construct(Server\Server $socket) { parent::__construct($socket, 'Can\'t bind to socket'); }
public function __construct($url) { $this->url = $url; // We could log an entry here with the search parameters parent::__construct(_('Invalid URL.')); }
public function __construct(Notice $notice) { $this->notice = $notice; parent::__construct(sprintf(_('No parent for notice with ID "%s".'), $this->notice->id)); }