/**
  * @inheritdoc
  */
 public function error($errors, $defaultStatusCode = null, array $headers = [])
 {
     if (is_string($errors) && !empty($errors)) {
         $errors = $this->errors->error($errors);
     }
     $response = new ErrorResponse($errors, $defaultStatusCode, $headers);
     return $this->errors($response);
 }
 /**
  * @inheritdoc
  */
 public function relationshipNotAcceptable(ResourceIdentifierInterface $identifier, $relationshipKey = null, $error = null)
 {
     $base = $this->repository->errorWithPointer(self::RELATIONSHIP_NOT_ACCEPTABLE, $relationshipKey ? P::relationship($relationshipKey) : P::data(), ['type' => $identifier->getType(), 'id' => $identifier->getId()]);
     $errors = new MutableErrorCollection();
     /** @var MutableErrorInterface $err */
     foreach (MutableErrorCollection::cast($error ?: $base) as $err) {
         $add = clone $base;
         $errors->add($add->merge($err));
     }
     return $errors;
 }
 /**
  * @return ErrorInterface
  */
 protected function getDefaultError()
 {
     return $this->errors->error(Exception::class);
 }