Skip to content

Commit

Permalink
Improverbosity by InvalidBody showing the root and the reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jan 26, 2023
1 parent 5f98f98 commit aa61adc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PSR7/Exception/Validation/InvalidBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ public static function becauseBodyDoesNotMatchSchema(
SchemaMismatch $prev
): self {
$exception = static::fromAddrAndPrev($addr, $prev);
$exception->message = sprintf('Body does not match schema for content-type "%s" for %s', $contentType, $addr);
$exception->message = sprintf(
'Body does not match schema for content-type "%s" for %s. [%s in %s]',
$contentType,
$addr,
substr($prev->getMessage(), 0, -1),
implode('->', $prev->dataBreadCrumb()->buildChain()));

return $exception;
}
Expand Down

0 comments on commit aa61adc

Please sign in to comment.