diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2017-04-26 15:10:43 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-04-26 21:10:43 +0800 |
commit | 8371f94d06cefbd65392af3b5c0f1fd1057429f7 (patch) | |
tree | d6bf49ee4406be76e5429bc70da4a5dee22e3cab /models/error.go | |
parent | b7da5a6cb7c725232c1053a1ca705a6ac0dad467 (diff) | |
download | gitea-8371f94d06cefbd65392af3b5c0f1fd1057429f7.tar.gz gitea-8371f94d06cefbd65392af3b5c0f1fd1057429f7.zip |
Rework SSH key management UI to add GPG (#1293)
* Rework SSH key management UI to add GPG
* Add more detail to gpg key display
* Update CHANGELOG.md
* Implement deletion UI
* Implement adding gpg UI
* Various fixes
- Fix duplicate entry in locale
- Re-generate hash before verification since they are consumed
* Add missing translation
* Split template
* Catch not found/verified email error
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index 68bc238907..404939c58a 100644 --- a/models/error.go +++ b/models/error.go @@ -260,6 +260,36 @@ func (err ErrKeyNameAlreadyUsed) Error() string { return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name) } +// ErrGPGEmailNotFound represents a "ErrGPGEmailNotFound" kind of error. +type ErrGPGEmailNotFound struct { + Email string +} + +// IsErrGPGEmailNotFound checks if an error is a ErrGPGEmailNotFound. +func IsErrGPGEmailNotFound(err error) bool { + _, ok := err.(ErrGPGEmailNotFound) + return ok +} + +func (err ErrGPGEmailNotFound) Error() string { + return fmt.Sprintf("failed to found email or is not confirmed : %s", err.Email) +} + +// ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error. +type ErrGPGKeyParsing struct { + ParseError error +} + +// IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing. +func IsErrGPGKeyParsing(err error) bool { + _, ok := err.(ErrGPGKeyParsing) + return ok +} + +func (err ErrGPGKeyParsing) Error() string { + return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error()) +} + // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error. type ErrGPGKeyNotExist struct { ID int64 |