Feat: Improve invalid resource template messages (#245)
This commit is contained in:
parent
0b1d0380c9
commit
aafac3ddf5
1 changed files with 90 additions and 2 deletions
|
|
@ -59,10 +59,10 @@ class ResourceTemplate implements \JsonSerializable
|
|||
public readonly ?array $meta = null,
|
||||
) {
|
||||
if (!preg_match(self::RESOURCE_NAME_PATTERN, $name)) {
|
||||
throw new InvalidArgumentException('Invalid resource name: must contain only alphanumeric characters, underscores, and hyphens.');
|
||||
throw new InvalidArgumentException(\sprintf('Invalid resource name "%s": must contain only alphanumeric characters, underscores, and hyphens.', $name));
|
||||
}
|
||||
if (!preg_match(self::URI_TEMPLATE_PATTERN, $uriTemplate)) {
|
||||
throw new InvalidArgumentException('Invalid URI template: must be a valid URI template with at least one placeholder.');
|
||||
throw new InvalidArgumentException(\sprintf('Invalid URI template : "%s" must be a valid URI template with at least one placeholder.', $uriTemplate));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue