Domain/DomainUtil.php
public static function addResourceError(ResourceInterface $resource, $message, \Exception $e = null): void
    {
        $resource->setStatus(ResourceStatutes::ERROR);
        $resource->getErrors()->add(new ConstraintViolation($message, $message, [], $resource->getRealData(), null, null, null, null, null, $e));
    }
public static function addResourceError(ResourceInterface $resource, $message, \Exception $e = null): void
    {
        $resource->setStatus(ResourceStatutes::ERROR);
        $resource->getErrors()->add(new ConstraintViolation($message, $message, [], $resource->getRealData(), null, null, null, null, null, $e));
    }
public static function addResourceError ( ResourceInterface $ resource , $ message , \ Exception $ e = null ) : void { $ resource -> setStatus ( ResourceStatutes :: ERROR ) ; $ resource -> getErrors ( ) -> add ( new ConstraintViolation ( $ message , $ message , [ ] , $ resource -> getRealData ( ) , null , null , null , null , null , $ e ) ) ; }
Add the error in resource.

@param ResourceInterface $resource The resource
@param string            $message  The error message
@param null|\Exception   $e        The exception
Add the error in resource .