Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error handling and validation #4

Merged
merged 3 commits into from
Sep 3, 2024
Merged

Conversation

chabanyknikita
Copy link
Contributor

No description provided.

@@ -11,6 +11,7 @@ type VerifyUsers struct {
Nationality string `db:"nationality"`
CreatedAt time.Time `db:"created_at"`
Uniqueness bool `db:"uniqueness"`
EventId string `db:"event_id"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
var-naming: struct field EventId should be EventID (revive)

ape.RenderErr(w, problems.BadRequest(err)...)
Log(r).WithError(err).Errorf("failed to extract user hash from event data")
ape.RenderErr(w, problems.BadRequest(validation.Errors{
"pub_signals/event_data": validation.Validate(getter.Get(zk.EventData), validation.When(userIDHash == getter.Get(zk.EventData), validation.Required)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you already have error, just wrap it with validation.Errors

@chabanyknikita chabanyknikita merged commit f4a0968 into main Sep 3, 2024
1 check passed
@mhrynenko mhrynenko deleted the feature/event-id branch December 5, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants