-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErrorHandlerInterface.php
32 lines (26 loc) · 1.27 KB
/
ErrorHandlerInterface.php
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
<?php
/*
* Copyright (c) Fusonic GmbH. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
declare(strict_types=1);
namespace Fusonic\HttpKernelBundle\ErrorHandler;
use Symfony\Component\Validator\ConstraintViolationListInterface;
interface ErrorHandlerInterface
{
/**
* If no object can be created from the given class and request no further processing is possible and an exception
* has to be thrown. The request data and the Dto class name are passed here. These can be used to determine
* some missing details. For example: the {@see \Symfony\Component\Serializer\Exception\InvalidArgumentException}
* class does not provide any info about the possible 'property path'. With the given data and the class name
* reflection can be used to figure it out.
*
* @param array<string, mixed> $data
* @param class-string $className
*/
public function handleDenormalizeError(\Throwable $ex, array $data, string $className): \Throwable;
/**
* If only constraint violations are discovered but the object could be created, the choice what to do is the devs.
*/
public function handleConstraintViolations(ConstraintViolationListInterface $list): void;
}