Domain/DomainUtil.php
public static function injectErrorMessage(TranslatorInterface $translator, ResourceInterface $resource, \Exception $e, $debug = false)
    {
        if ($e instanceof ConstraintViolationException) {
            $resource->setStatus(ResourceStatutes::ERROR);
            $resource->getErrors()->addAll($e->getConstraintViolations());
        } else {
            static::addResourceError($resource, static::getExceptionMessage($translator, $e, $debug), $e);
        }

        return true;
    }
public static function injectErrorMessage(TranslatorInterface $translator, ResourceInterface $resource, \Exception $e, $debug = false)
    {
        if ($e instanceof ConstraintViolationException) {
            $resource->setStatus(ResourceStatutes::ERROR);
            $resource->getErrors()->addAll($e->getConstraintViolations());
        } else {
            static::addResourceError($resource, static::getExceptionMessage($translator, $e, $debug), $e);
        }

        return true;
    }
public static function injectErrorMessage ( TranslatorInterface $ translator , ResourceInterface $ resource , \ Exception $ e , $ debug = false ) { if ( $ e instanceof ConstraintViolationException ) { $ resource -> setStatus ( ResourceStatutes :: ERROR ) ; $ resource -> getErrors ( ) -> addAll ( $ e -> getConstraintViolations ( ) ) ; } else { static :: addResourceError ( $ resource , static :: getExceptionMessage ( $ translator , $ e , $ debug ) , $ e ) ; } return true ; }
Inject the exception message in resource error list.

@param TranslatorInterface $translator The translator
@param ResourceInterface   $resource   The resource
@param \Exception          $e          The exception on persist action
@param bool                $debug      The debug mode

@return bool
Inject the exception message in resource error list .