Catch account already activated error and redirect

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-11 14:25:05 +04:00
parent 961980f852
commit af17afeffb
3 changed files with 26 additions and 8 deletions

View File

@@ -94,6 +94,20 @@ func NDASignatureRequiredf(ctx context.Context, format string, a ...any) *gqlerr
return NDASignatureRequired(ctx, fmt.Errorf(format, a...))
}
func AccountAlreadyActivated(ctx context.Context, err error) *gqlerror.Error {
return &gqlerror.Error{
Message: err.Error(),
Path: graphql.GetPath(ctx),
Extensions: map[string]any{
"code": "ACCOUNT_ALREADY_ACTIVATED",
},
}
}
func AccountAlreadyActivatedf(ctx context.Context, format string, a ...any) *gqlerror.Error {
return AccountAlreadyActivated(ctx, fmt.Errorf(format, a...))
}
func Forbidden(ctx context.Context, err error) *gqlerror.Error {
return &gqlerror.Error{
Message: err.Error(),