コード例 #1
0
ファイル: filelocked.php プロジェクト: kenwi/core
 public function __construct($message = "", $code = 0, Exception $previous = null)
 {
     if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
         $message = sprintf('Target file %s is locked by another process.', $previous->path);
     }
     parent::__construct($message, $code, $previous);
 }
コード例 #2
0
 /**
  * Create the exception
  *
  * @param string $message
  * @param string $header
  */
 function __construct($message, $header = null)
 {
     parent::__construct($message);
     $this->header = $header;
 }
コード例 #3
0
ファイル: dav.php プロジェクト: heldernl/owncloud8-extended
 /**
  * Convert sabre DAV exception to a storage exception,
  * then throw it
  *
  * @param \Sabre\Dav\Exception $e sabre exception
  * @throws StorageInvalidException if the storage is invalid, for example
  * when the authentication expired or is invalid
  * @throws StorageNotAvailableException if the storage is not available,
  * which might be temporary
  */
 private function convertSabreException(\Sabre\Dav\Exception $e)
 {
     \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
     if ($e instanceof \Sabre\DAV\Exception\NotAuthenticated) {
         // either password was changed or was invalid all along
         throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage());
     } else {
         if ($e instanceof \Sabre\DAV\Exception\MethodNotAllowed) {
             // ignore exception, false will be returned
             return;
         }
     }
     throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
 }
コード例 #4
0
ファイル: InvalidPath.php プロジェクト: GitHubUser4234/core
 /**
  * @param string $message
  * @param bool $retry
  */
 public function __construct($message, $retry = false)
 {
     parent::__construct($message);
     $this->retry = $retry;
 }
コード例 #5
0
ファイル: CorePlugin.php プロジェクト: BlaBlaNet/hubzilla
 /**
  * Listens for exception events, and automatically logs them.
  *
  * @param Exception $e
  */
 function exception($e)
 {
     $logLevel = \Psr\Log\LogLevel::CRITICAL;
     if ($e instanceof \Sabre\DAV\Exception) {
         // If it's a standard sabre/dav exception, it means we have a http
         // status code available.
         $code = $e->getHTTPCode();
         if ($code >= 400 && $code < 500) {
             // user error
             $logLevel = \Psr\Log\LogLevel::INFO;
         } else {
             // Server-side error. We mark it's as an error, but it's not
             // critical.
             $logLevel = \Psr\Log\LogLevel::ERROR;
         }
     }
     $this->server->getLogger()->log($logLevel, 'Uncaught exception', ['exception' => $e]);
 }