yiisoft / yiisoft/error-handler
Add support classes for exception map in `ExceptionResponder`
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 18
- Avg merge
- 1h
- Merged PRs (30d)
- 1
Description
It can make several ways.
One / Container + Callable
Configuration:
$exceptionMap = [
MyNotFoundException::class => MyExceptionHandler::class,
];
Handling: get MyExceptionHandler class from container and run as callable (use __invoke()) via injector.
Two / Container + Interface
Configuration:
$exceptionMap = [
MyNotFoundException::class => MyExceptionHandler::class,
];
Add new interface ExceptionHandlerInterface with method createResponse(Throwable $e): ResponseInterface.
Handling: get MyExceptionHandler class from container and run createResponse().
Three / Array Definition + Callable
Add support of array definitions:
$exceptionMap = [
MyNotFoundException::class => [
'class' => MyExceptionHandler::class,
'__construct()' => [ ... ],
],
];
Handling: resolve array definition via yiisoft/definitions and run as callable (use __invoke()) via injector.
Four / Array Definition + Interface
Add support of array definitions:
$exceptionMap = [
MyNotFoundException::class => [
'class' => MyExceptionHandler::class,
'__construct()' => [ ... ],
],
];
Add new interface ExceptionHandlerInterface with method createResponse(Throwable $e): ResponseInterface.
Handling: resolve array definition via yiisoft/definitions and run createResponse().
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ExceptionResponder and inspect how the exception map is currently configured and handled. Compare the four proposed combinations of container or array definitions with callable or ExceptionHandlerInterface handling, including yiisoft/definitions resolution. Done means the selected exception-map forms resolve handlers and produce responses as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100