From ee538d6167003a658d3c83f46710d6ed6880a001 Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Wed, 7 Aug 2024 21:56:32 +0530 Subject: [PATCH] improves error handling --- CHANGELOG.md | 4 ++++ supertokens/constants.go | 2 +- supertokens/supertokens.go | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d2cf53..107d33c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [0.24.1] - 2024-09-07 + +- Improves debug logs for error handlers. + ## [0.24.0] - 2024-07-29 ### Changes diff --git a/supertokens/constants.go b/supertokens/constants.go index 6464b10b..ead78783 100644 --- a/supertokens/constants.go +++ b/supertokens/constants.go @@ -21,7 +21,7 @@ const ( ) // VERSION current version of the lib -const VERSION = "0.24.0" +const VERSION = "0.24.1" var ( cdiSupported = []string{"3.1"} diff --git a/supertokens/supertokens.go b/supertokens/supertokens.go index 7df1b4ff..30caf20f 100644 --- a/supertokens/supertokens.go +++ b/supertokens/supertokens.go @@ -335,13 +335,15 @@ func (s *superTokens) errorHandler(originalError error, req *http.Request, res h } for _, recipe := range s.RecipeModules { LogDebugMessage("errorHandler: Checking recipe for match: " + recipe.recipeID) + LogDebugMessage("errorHandler: error: " + originalError.Error()) if recipe.HandleError != nil { - LogDebugMessage("errorHandler: Matched with recipeId: " + recipe.recipeID) handled, err := recipe.HandleError(originalError, req, res, userContext) if err != nil { + LogDebugMessage("errorHandler: error from error handler " + err.Error()) return err } if handled { + LogDebugMessage("errorHandler: Matched with recipeId: " + recipe.recipeID) return nil } }