Overview

Namespaces

  • SKJ
    • AppException
      • HTTP
      • Logic
      • Runtime

Classes

  • SKJ\Label

Interfaces

  • SKJ\AppExceptionInterface

Traits

  • SKJ\AppExceptionMethods

Exceptions

  • SKJ\AppException
  • SKJ\AppException\AbstractContainerException
  • SKJ\AppException\AbstractDateTimeException
  • SKJ\AppException\AbstractHttpException
  • SKJ\AppException\AbstractValidationException
  • SKJ\AppException\HTTP\BadGatewayException
  • SKJ\AppException\HTTP\BadRequestException
  • SKJ\AppException\HTTP\ConflictException
  • SKJ\AppException\HTTP\ExpectationFailedException
  • SKJ\AppException\HTTP\FailedDependencyException
  • SKJ\AppException\HTTP\ForbiddenException
  • SKJ\AppException\HTTP\GatewayTimeoutException
  • SKJ\AppException\HTTP\GoneException
  • SKJ\AppException\HTTP\HttpVersionNotSupportedException
  • SKJ\AppException\HTTP\InternalServerErrorException
  • SKJ\AppException\HTTP\LengthRequiredException
  • SKJ\AppException\HTTP\LockedException
  • SKJ\AppException\HTTP\MethodNotAllowedException
  • SKJ\AppException\HTTP\NotAcceptableException
  • SKJ\AppException\HTTP\NotFoundException
  • SKJ\AppException\HTTP\NotImplementedException
  • SKJ\AppException\HTTP\PaymentRequiredException
  • SKJ\AppException\HTTP\PreconditionFailedException
  • SKJ\AppException\HTTP\ProxyAuthenticationRequiredException
  • SKJ\AppException\HTTP\RequestedRangeNotSatisfiableException
  • SKJ\AppException\HTTP\RequestEntityTooLargeException
  • SKJ\AppException\HTTP\RequestTimeoutException
  • SKJ\AppException\HTTP\RequestUriTooLongException
  • SKJ\AppException\HTTP\ServiceUnavailableException
  • SKJ\AppException\HTTP\UnauthorizedException
  • SKJ\AppException\HTTP\UnprocessableEntityException
  • SKJ\AppException\HTTP\UnsupportedMediaTypeException
  • SKJ\AppException\HttpException
  • SKJ\AppException\Logic\BadFunctionCallException
  • SKJ\AppException\Logic\BadMethodCallException
  • SKJ\AppException\Logic\CircularReferenceException
  • SKJ\AppException\Logic\ContainerException
  • SKJ\AppException\Logic\DependencyInjectionException
  • SKJ\AppException\Logic\DomainException
  • SKJ\AppException\Logic\EnvironmentException
  • SKJ\AppException\Logic\InvalidArgumentException
  • SKJ\AppException\Logic\LengthException
  • SKJ\AppException\Logic\OutOfRangeException
  • SKJ\AppException\Logic\UnexpectedValueException
  • SKJ\AppException\LogicException
  • SKJ\AppException\Runtime\AuthenticationException
  • SKJ\AppException\Runtime\DeadLockException
  • SKJ\AppException\Runtime\DuplicationException
  • SKJ\AppException\Runtime\DurationException
  • SKJ\AppException\Runtime\EmptyResultException
  • SKJ\AppException\Runtime\ExpiryException
  • SKJ\AppException\Runtime\InvalidElementException
  • SKJ\AppException\Runtime\MissingElementException
  • SKJ\AppException\Runtime\NoConditionException
  • SKJ\AppException\Runtime\OutOfBoundsException
  • SKJ\AppException\Runtime\OverflowException
  • SKJ\AppException\Runtime\PermissionException
  • SKJ\AppException\Runtime\RangeException
  • SKJ\AppException\Runtime\TemporaryFailureException
  • SKJ\AppException\Runtime\TimeoutException
  • SKJ\AppException\Runtime\TransactionException
  • SKJ\AppException\Runtime\UnavailableServiceException
  • SKJ\AppException\Runtime\UnderflowException
  • SKJ\AppException\Runtime\UnexpectedValueException
  • SKJ\AppException\Runtime\UploadException
  • SKJ\AppException\Runtime\ValidationException
  • SKJ\AppException\Runtime\WrongArgumentException
  • SKJ\AppException\RuntimeException
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 
<?php
// このファイルの名前空間の定義
namespace SKJ\AppException;

// 別名定義
use SKJ\AppExceptionInterface;

/**
 * 未知、未分類の例外が連結されたロジック例外の抽象クラス
 *
 * 未知、未分類の例外を受け取った場合、その例外を連結して使用する例外です
 *
 * ◆詳細◆
 * <ul>
 *     <li>このクラスは抽象クラスです</li>
 * </ul>
 *
 * @package SKJ\AppException
 * @version 0.8.0
 * @author y3high <y3public@49364.net>
 * @copyright 2019 Seikouhou.
 * @license https://opensource.org/licenses/MIT MIT
 * @since Class available since Release 0.8.0
 */
abstract class AbstractContainerException extends LogicException
{
    /**
     * 独自初期化処理
     *
     * AppExceptionのコンストラクタから呼ばれる、この例外の初期化処理です
     *
     * @internal
     * @return bool 成功時に真、コンストラクタに連結される例外が渡されていない場合は偽
     * @throws \SKJ\AppExceptionInterface 梱包の必要がない場合は連結された例外をそのまま投げる
     */
    protected function initialize()
    {
        /** @var \SKJ\AppExceptionInterface $previous */
        $previous = $this->getPrevious();

        // 梱包すべき例外がセットされていない
        if (!$previous instanceof AppExceptionInterface) {

            return false;
        }

        // ニ度は梱包しない
        if (get_class($previous) === get_class($this)) {

            throw $previous;
        }

        // 同一コンテキストで発生した例外はそのまま放流
        $debugBackTrace = debug_backtrace();
        // __construct() → initialize()の流れなので1つ除去する必要有り!!
        array_shift($debugBackTrace);
        if ($previous->wasCreatedInCurrentContext($debugBackTrace)) {

            // 以前の例外はコンストラクタで必ずApp系に変換されているはずなので!!
            throw $previous;
        }

        // 各種情報はそのまま継承する
        $this->setMessage($previous->getMessage());
        $this->setCode($previous->getCode());
        $this->setFields($previous->getFields());
        $this->setStatusCode($previous->getStatusCode());

        return true;
    }
}
API documentation generated by ApiGen