From 60df024907d9e5a8f59e9580bb9b8564795a592c Mon Sep 17 00:00:00 2001 From: viehlieb Date: Fri, 27 Jan 2023 13:22:42 +0100 Subject: [PATCH] add errors to user --- pkg/user/error.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pkg/user/error.go b/pkg/user/error.go index a5ac4a37e..1f6099e1a 100644 --- a/pkg/user/error.go +++ b/pkg/user/error.go @@ -426,6 +426,32 @@ func (err *ErrNoOpenIDEmailProvided) HTTPError() web.HTTPError { } } +// ErrNoOpenIDEmailProvided represents a "NoEmailProvided" kind of error. +type ErrOpenIDCustomScopeMalformed struct { +} + +// IsErrNoEmailProvided checks if an error is a ErrNoOpenIDEmailProvided. +func IsErrOpenIDCustomScopeMalformed(err error) bool { + _, ok := err.(*ErrOpenIDCustomScopeMalformed) + return ok +} + +func (err *ErrOpenIDCustomScopeMalformed) Error() string { + return "Custom Scope malformed" +} + +// ErrCodeNoOpenIDEmailProvided holds the unique world-error code of this error +const ErrCodeOpenIDCustomScopeMalformed = 1022 + +// HTTPError holds the http error description +func (err *ErrOpenIDCustomScopeMalformed) HTTPError() web.HTTPError { + return web.HTTPError{ + HTTPCode: http.StatusPreconditionFailed, + Code: ErrCodeOpenIDCustomScopeMalformed, + Message: "The custom scope set by the OIDC provider is malformed. Please make sure the openid provider sets the data correctly for your scope. Check especially to have set an oidcID", + } +} + // ErrAccountDisabled represents a "AccountDisabled" kind of error. type ErrAccountDisabled struct { UserID int64