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:
Tim Möhlmann
2023-12-08 16:30:55 +02:00
committed by GitHub
parent ddbea119f1
commit f680dd934d
798 changed files with 5809 additions and 5813 deletions

View File

@@ -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
}