| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Rest\Reporter; |
| 4 | |
| 5 | use MediaWiki\Rest\Handler; |
| 6 | use MediaWiki\Rest\RequestInterface; |
| 7 | use MWExceptionHandler; |
| 8 | use Throwable; |
| 9 | |
| 10 | /** |
| 11 | * Error reporter based on MWExceptionHandler. |
| 12 | * @see MWExceptionHandler |
| 13 | * @since 1.38 |
| 14 | */ |
| 15 | class MWErrorReporter implements ErrorReporter { |
| 16 | |
| 17 | /** |
| 18 | * @param Throwable $error |
| 19 | * @param Handler|null $handler |
| 20 | * @param RequestInterface $request |
| 21 | */ |
| 22 | public function reportError( Throwable $error, ?Handler $handler, RequestInterface $request ) { |
| 23 | MWExceptionHandler::rollbackPrimaryChangesAndLog( |
| 24 | $error, |
| 25 | MWExceptionHandler::CAUGHT_BY_ENTRYPOINT |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | } |