mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
refactor: rename package errors to zerrors (#7039)
* chore: rename package errors to zerrors * rename package errors to gerrors * fix error related linting issues * fix zitadel error assertion * fix gosimple linting issues * fix deprecated linting issues * resolve gci linting issues * fix import structure --------- Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
14
internal/auth_request/repository/cache/cache.go
vendored
14
internal/auth_request/repository/cache/cache.go
vendored
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/database"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
caos_errs "github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
type AuthRequestCache struct {
|
||||
@@ -50,7 +50,7 @@ func (c *AuthRequestCache) UpdateAuthRequest(_ context.Context, request *domain.
|
||||
func (c *AuthRequestCache) DeleteAuthRequest(ctx context.Context, id string) error {
|
||||
_, err := c.client.Exec("DELETE FROM auth.auth_requests WHERE instance_id = $1 and id = $2", authz.GetInstance(ctx).InstanceID(), id)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "CACHE-dsHw3", "unable to delete auth request")
|
||||
return zerrors.ThrowInternal(err, "CACHE-dsHw3", "unable to delete auth request")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -67,16 +67,16 @@ func (c *AuthRequestCache) getAuthRequest(key, value, instanceID string) (*domai
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, caos_errs.ThrowNotFound(err, "CACHE-d24aD", "Errors.AuthRequest.NotFound")
|
||||
return nil, zerrors.ThrowNotFound(err, "CACHE-d24aD", "Errors.AuthRequest.NotFound")
|
||||
}
|
||||
return nil, caos_errs.ThrowInternal(err, "CACHE-as3kj", "Errors.Internal")
|
||||
return nil, zerrors.ThrowInternal(err, "CACHE-as3kj", "Errors.Internal")
|
||||
}
|
||||
request, err := domain.NewAuthRequestFromType(requestType)
|
||||
if err == nil {
|
||||
err = json.Unmarshal(b, request)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, caos_errs.ThrowInternal(err, "CACHE-2wshg", "Errors.Internal")
|
||||
return nil, zerrors.ThrowInternal(err, "CACHE-2wshg", "Errors.Internal")
|
||||
}
|
||||
return request, nil
|
||||
}
|
||||
@@ -84,11 +84,11 @@ func (c *AuthRequestCache) getAuthRequest(key, value, instanceID string) (*domai
|
||||
func (c *AuthRequestCache) saveAuthRequest(request *domain.AuthRequest, query string, date time.Time, param interface{}) error {
|
||||
b, err := json.Marshal(request)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "CACHE-os0GH", "Errors.Internal")
|
||||
return zerrors.ThrowInternal(err, "CACHE-os0GH", "Errors.Internal")
|
||||
}
|
||||
_, err = c.client.Exec(query, request.ID, b, request.InstanceID, date, param)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "CACHE-su3GK", "Errors.Internal")
|
||||
return zerrors.ThrowInternal(err, "CACHE-su3GK", "Errors.Internal")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user