minor #437 Custom encoder documentation: encode & decode methods should properly throw exceptions (chteuchteu)
minor #437 Custom encoder documentation: encode & decode methods should properly throw exceptions (chteuchteu)

This PR was submitted for the master branch but it was merged into the 2.4 branch instead (closes #437).

Discussion
----------

Custom encoder documentation: encode & decode methods should properly throw exceptions

...instead of failing silently

I also ensured that the `encode` method throws a proper `JWTEncodeFailureException` exception (just like it's done in the [default encoder](https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Encoder/DefaultEncoder.php#L37)). For instance, a `\DomainException` could be thrown in the `\JWT\Authentication\JWT::sign` method if an incorrect algo is provided. Mostly to highlight the fact that generic exceptions should be caught and converted into `JWT(Encode|Decode)FailureException`s.

Closes #431

Commits
-------

244df08 Custom encoder documentation: encode & decode methods should properly throw exceptions instead of failing silently

chalasr/LexikJWTAuthenticationBundle,lexik/LexikJWTAuthenticationBundle