Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception classes and their abstract should have common signatures #2

Open
neuberkauf opened this issue May 16, 2023 · 0 comments
Open
Labels
enhancement New feature or request
Milestone

Comments

@neuberkauf
Copy link

Example:

/**
 * NotFoundHttpException constructor.
 *
 * @param string|null     $errorDescription
 * @param array           $errorData
 * @param string|null     $userTitle
 * @param null            $userMessage
 * @param array           $headers
 * @param \Exception|null $previous
 */
// Consistent signature
/**
 * AccessDeniedHttpException constructor.
 *
 * @param string|null     $errorDescription
 * @param array           $errorData
 * @param string|null     $userTitle
 * @param null            $userMessage
 * @param array           $headers
 * @param \Exception|null $previous
 */
/**
 * ServiceUnavailableHttpException constructor.
 *
 * @param int|null        $wait     // Pushes the signature out of alignment
 * @param string|null     $errorDescription
 * @param array           $errorData
 * @param string|null     $userTitle
 * @param null            $userMessage
 * @param array           $headers
 * @param \Exception|null $previous
 */
/**
 * HttpException constructor.
 *
 * @param int             $statusCode   // Provided by the child class
 * @param array           $httpHeaders  // Opposite end of the signature from the child
 * @param string          $error        // Internal (?) name for the error
 * @param string          $errorDescription  
 * @param array           $errorData
 * @param string          $userTitle
 * @param string          $userMessage
 * @param \Exception|null $previous
 */

Given the length of these signatures and different requirements, it may be more beneficial to provide the common Exception elements (message, code, previous), with an array of other values that can be checked for presence, requirement, type, etc.

@jtheuerkauf jtheuerkauf added the enhancement New feature or request label Sep 25, 2023
@jtheuerkauf jtheuerkauf added this to the Release 1.1 milestone Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants