user.go 459 B

12345678910111213141516171819202122
  1. // Copyright 2017 The Gogs 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 errors
  5. import (
  6. "fmt"
  7. )
  8. type UserNotKeyOwner struct {
  9. KeyID int64
  10. }
  11. func IsUserNotKeyOwner(err error) bool {
  12. _, ok := err.(UserNotKeyOwner)
  13. return ok
  14. }
  15. func (err UserNotKeyOwner) Error() string {
  16. return fmt.Sprintf("user is not the owner of public key [key_id: %d]", err.KeyID)
  17. }