mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
# Which Problems Are Solved As part of https://github.com/zitadel/zitadel/issues/11917 we want to introduce error slugs so (API) clients can rely on stable, machine-readable errors and act accordingly. # How the Problems Are Solved - Added a `NewSlug` helper function in the domain package. - Added `ErrorDetails` to the `ZitadelError` - Added an `zitadel.error.v2.ErrorDetail` proto message - Updated the connectRPC error interceptor to map new slug based errors to the new `ErrorDetail` - Defined some common slugs and error functions like internal errors - Defined (session) specific slugs used in the `DeleteSession` and `CheckUser` functions and replaced old implementations - Updated integration tests to check specific errors if the relation database feature is enabled - Updated doc and guideline to reflect the latest changes and decisions - Updated DeleteSession endpoint API to list possible slugs # Additional Changes None # Additional Context - closes #11957 --------- Co-authored-by: Wim Van Laer <[email protected]>
19 lines
491 B
Go
19 lines
491 B
Go
package zerrors
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func ThrowPermissionDenied(parent error, id, message string) error {
|
|
return CreateZitadelError(KindPermissionDenied, parent, id, message, 1)
|
|
}
|
|
|
|
func ThrowPermissionDeniedf(parent error, id, format string, a ...any) error {
|
|
return CreateZitadelError(KindPermissionDenied, parent, id, fmt.Sprintf(format, a...), 1)
|
|
}
|
|
|
|
func IsPermissionDenied(err error) bool {
|
|
zitadelErr, ok := AsZitadelError(err)
|
|
return ok && zitadelErr.Kind == KindPermissionDenied
|
|
}
|