You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2022/04/14 09:32:22 UTC

[couchdb] 01/01: Cause a 400 Bad Request if decoding JWT token fails

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch jwtf-error-handling
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 39a8e1c679cfe8f463c07c5cfbf46dfa8223749e
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Apr 14 10:32:01 2022 +0100

    Cause a 400 Bad Request if decoding JWT token fails
---
 src/jwtf/src/jwtf.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/jwtf/src/jwtf.erl b/src/jwtf/src/jwtf.erl
index 1dedb36f1..2bb005bcb 100644
--- a/src/jwtf/src/jwtf.erl
+++ b/src/jwtf/src/jwtf.erl
@@ -310,8 +310,8 @@ decode_b64url_json(B64UrlEncoded) ->
                 jiffy:decode(JsonEncoded)
         end
     catch
-        error:Error ->
-            throw({bad_request, Error})
+        _:_ ->
+            throw({bad_request, <<"Malformed token">>})
     end.
 
 props({Props}) ->