Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Verbose exception message from header validators #142

Merged

Conversation

mtymek
Copy link
Contributor

@mtymek mtymek commented Jan 27, 2016

With current version of Diactoros I often see exceptions like "Invalid header value". It doesn't show which header is not valid, making it difficult to see what's the problem.
With this PR server logs will clearly show which header caused exception.

@@ -129,7 +129,7 @@ public static function isValid($value)
public static function assertValid($value)
{
if (! self::isValid($value)) {
throw new InvalidArgumentException('Invalid header value');
throw new InvalidArgumentException("'$value' is not valid header value");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically use sprintf() for interpolation in exception messages; I'll make that change on merge.

@weierophinney weierophinney added this to the 1.3.4 milestone Mar 17, 2016
@weierophinney weierophinney self-assigned this Mar 17, 2016
@weierophinney weierophinney merged commit 43b327b into zendframework:master Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
Verbose exception message from header validators
weierophinney added a commit that referenced this pull request Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
weierophinney added a commit that referenced this pull request Mar 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants