Skip to content

Commit

Permalink
improves error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Aug 7, 2024
1 parent b664087 commit ee538d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion supertokens/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
4 changes: 3 additions & 1 deletion supertokens/supertokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit ee538d6

Please sign in to comment.