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

Commit

Permalink
Verbose exception message for header validators
Browse files Browse the repository at this point in the history
  • Loading branch information
mtymek committed Jan 27, 2016
1 parent 5587c48 commit 43b327b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HeaderSecurity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand All @@ -143,7 +143,7 @@ public static function assertValid($value)
public static function assertValidName($name)
{
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) {
throw new InvalidArgumentException('Invalid header name');
throw new InvalidArgumentException("'$name' is not valid header name");
}
}
}

0 comments on commit 43b327b

Please sign in to comment.