Skip to content

DomainException is missing in the "throws" list #312

Closed
@dakujem

Description

@dakujem

Hello guys, I noticed a problem with the doc comment of JWT::decode method, in the list of what the method throws, DomainException is missing. This happens for malformed JWT (like the one below).
Also, InvalidArgumentException is thrown too, even though in a different context.

I'd suggest adding these lines:

     * @throws DomainException              Provided JWT is malformed
     * @throws InvalidArgumentException     Provided key is empty

The doc comment makes devs (me 🤷‍♂️) assume that it is enough to catch the UnexpectedValueException, which is not true.
Everything works until someone sends in a malformed token.

How to replicate:

JWT::decode(
    'foo.bar.qux',
    'anything',
    ['doesntmatter']
);

Would you be interested in a PR instead of an issue?

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