Skip to content

Improve error message for invalid resource URI #231

@alexislefebvre

Description

@alexislefebvre

Is your feature request related to a problem? Please describe.

I tried to provide a resource with an invalid URI: /list-books.

I encountered this error:

Invalid resource URI: must be a valid URI with a scheme and optional path.

And the corresponding URI is not shown.

It comes from this line:

if (!preg_match(self::URI_PATTERN, $uri)) {
throw new InvalidArgumentException('Invalid resource URI: must be a valid URI with a scheme and optional path.');
}

Describe the solution you'd like

The error message may show the invalid data ($uri) to help debugging.

Something like this:

     throw new InvalidArgumentException('Invalid resource URI: '.$uri.' must be a valid URI with a scheme and optional path.'); 

Describe alternatives you've considered
.

Additional context
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions