From ab41ce832cd51a1426a6ae9f8132ba9db3fd55af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Mon, 8 Jul 2024 20:36:17 +0000 Subject: [PATCH] src: fix error handling in ExportJWKAsymmetricKey Because call sites check IsNothing() on the return value of ExportJWKAsymmetricKey() and ignore the boolean value if the return value is Just (i.e., not nothing), this function must return Nothing() instead of Just(false) when throwing a JavaScript error. --- src/crypto/crypto_keys.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index db03387d42c816..bb0541310e7e97 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -505,7 +505,7 @@ Maybe ExportJWKAsymmetricKey( case EVP_PKEY_X448: return ExportJWKEdKey(env, key, target); } THROW_ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE(env); - return Just(false); + return Nothing(); } std::shared_ptr ImportJWKAsymmetricKey(