Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

error_oauth2.go 852B

12345678910111213141516171819202122232425
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import "fmt"
  6. // ErrOpenIDConnectInitialize represents a "OpenIDConnectInitialize" kind of error.
  7. type ErrOpenIDConnectInitialize struct {
  8. OpenIDConnectAutoDiscoveryURL string
  9. ProviderName string
  10. Cause error
  11. }
  12. // IsErrOpenIDConnectInitialize checks if an error is a ExternalLoginUserAlreadyExist.
  13. func IsErrOpenIDConnectInitialize(err error) bool {
  14. _, ok := err.(ErrOpenIDConnectInitialize)
  15. return ok
  16. }
  17. func (err ErrOpenIDConnectInitialize) Error() string {
  18. return fmt.Sprintf("Failed to initialize OpenID Connect Provider with name '%s' with url '%s': %v", err.ProviderName, err.OpenIDConnectAutoDiscoveryURL, err.Cause)
  19. }