lib/Psc/Net/ServiceErrorPackage.php
public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
    if ($format === ServiceResponse::JSON) {
      $body = (object) array('errors'=>array());
    
      foreach ($list->getExceptions() as $validatorException) {
        $body->errors[$validatorException->field] = $validatorException->getMessage();
      }
    
      return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
    } else {
      $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
      
      return HTTPException::BadRequest(
          $list->getMessage(),
          $list,
          array_merge(
            array('Content-Type'=>'text/html'),
            $metadataGenerator->validationList($list)->toHeaders()
          )
      );
    }
  }
public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
    if ($format === ServiceResponse::JSON) {
      $body = (object) array('errors'=>array());
    
      foreach ($list->getExceptions() as $validatorException) {
        $body->errors[$validatorException->field] = $validatorException->getMessage();
      }
    
      return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
    } else {
      $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
      
      return HTTPException::BadRequest(
          $list->getMessage(),
          $list,
          array_merge(
            array('Content-Type'=>'text/html'),
            $metadataGenerator->validationList($list)->toHeaders()
          )
      );
    }
  }
public function validationResponse ( \ Psc \ Form \ ValidatorExceptionList $ list , $ format = ServiceResponse :: JSON , MetadataGenerator $ metadataGenerator = NULL ) { if ( $ format === ServiceResponse :: JSON ) { $ body = ( object ) array ( 'errors' => array ( ) ) ; foreach ( $ list -> getExceptions ( ) as $ validatorException ) { $ body -> errors [ $ validatorException -> field ] = $ validatorException -> getMessage ( ) ; } return HTTPResponseException :: BadRequest ( json_encode ( $ body ) , NULL , array ( 'Content-Type' => 'application/json' ) ) ; } else { $ metadataGenerator = $ metadataGenerator ? : new MetadataGenerator ( ) ; return HTTPException :: BadRequest ( $ list -> getMessage ( ) , $ list , array_merge ( array ( 'Content-Type' => 'text/html' ) , $ metadataGenerator -> validationList ( $ list ) -> toHeaders ( ) ) ) ; } }
Throws an ValidationResponse

it handles the JSON case and the HTML case
@param ValidatorException[]
@param const $format im moment nur JSON oder HTML
@return HTTPException
Throws an ValidationResponse