diff options
author | Unknwon <u@gogs.io> | 2018-12-01 21:41:30 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-12-01 21:41:30 -0500 |
commit | 69c1cd3f381b19b988a6af51a8e38303f216b001 (patch) | |
tree | 5b9ce7c21380d8f2a2338516bba55cc75dbac60f /models/errors | |
parent | ce13fbb98a68a39b9b08f07bf7c7444e1e869451 (diff) |
routes/api: change status handle to new style
Also fixed one bug that did not catch team not found error.
Diffstat (limited to 'models/errors')
-rw-r--r-- | models/errors/org.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/models/errors/org.go b/models/errors/org.go new file mode 100644 index 00000000..56532746 --- /dev/null +++ b/models/errors/org.go @@ -0,0 +1,21 @@ +// Copyright 2018 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package errors + +import "fmt" + +type TeamNotExist struct { + TeamID int64 + Name string +} + +func IsTeamNotExist(err error) bool { + _, ok := err.(TeamNotExist) + return ok +} + +func (err TeamNotExist) Error() string { + return fmt.Sprintf("team does not exist [team_id: %d, name: %s]", err.TeamID, err.Name) +} |