error.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. // Copyright 2015 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 db
  5. import (
  6. "fmt"
  7. )
  8. // ____ ___
  9. // | | \______ ___________
  10. // | | / ___// __ \_ __ \
  11. // | | /\___ \\ ___/| | \/
  12. // |______//____ >\___ >__|
  13. // \/ \/
  14. type ErrUserAlreadyExist struct {
  15. Name string
  16. }
  17. func IsErrUserAlreadyExist(err error) bool {
  18. _, ok := err.(ErrUserAlreadyExist)
  19. return ok
  20. }
  21. func (err ErrUserAlreadyExist) Error() string {
  22. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  23. }
  24. type ErrEmailAlreadyUsed struct {
  25. Email string
  26. }
  27. func IsErrEmailAlreadyUsed(err error) bool {
  28. _, ok := err.(ErrEmailAlreadyUsed)
  29. return ok
  30. }
  31. func (err ErrEmailAlreadyUsed) Error() string {
  32. return fmt.Sprintf("e-mail has been used [email: %s]", err.Email)
  33. }
  34. type ErrUserOwnRepos struct {
  35. UID int64
  36. }
  37. func IsErrUserOwnRepos(err error) bool {
  38. _, ok := err.(ErrUserOwnRepos)
  39. return ok
  40. }
  41. func (err ErrUserOwnRepos) Error() string {
  42. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  43. }
  44. type ErrUserHasOrgs struct {
  45. UID int64
  46. }
  47. func IsErrUserHasOrgs(err error) bool {
  48. _, ok := err.(ErrUserHasOrgs)
  49. return ok
  50. }
  51. func (err ErrUserHasOrgs) Error() string {
  52. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  53. }
  54. // __ __.__ __ .__
  55. // / \ / \__| | _|__|
  56. // \ \/\/ / | |/ / |
  57. // \ /| | <| |
  58. // \__/\ / |__|__|_ \__|
  59. // \/ \/
  60. type ErrWikiAlreadyExist struct {
  61. Title string
  62. }
  63. func IsErrWikiAlreadyExist(err error) bool {
  64. _, ok := err.(ErrWikiAlreadyExist)
  65. return ok
  66. }
  67. func (err ErrWikiAlreadyExist) Error() string {
  68. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  69. }
  70. // __________ ___. .__ .__ ____ __.
  71. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  72. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  73. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  74. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  75. // \/ \/ \/ \/\/
  76. type ErrKeyUnableVerify struct {
  77. Result string
  78. }
  79. func IsErrKeyUnableVerify(err error) bool {
  80. _, ok := err.(ErrKeyUnableVerify)
  81. return ok
  82. }
  83. func (err ErrKeyUnableVerify) Error() string {
  84. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  85. }
  86. type ErrKeyNotExist struct {
  87. ID int64
  88. }
  89. func IsErrKeyNotExist(err error) bool {
  90. _, ok := err.(ErrKeyNotExist)
  91. return ok
  92. }
  93. func (err ErrKeyNotExist) Error() string {
  94. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  95. }
  96. type ErrKeyAlreadyExist struct {
  97. OwnerID int64
  98. Content string
  99. }
  100. func IsErrKeyAlreadyExist(err error) bool {
  101. _, ok := err.(ErrKeyAlreadyExist)
  102. return ok
  103. }
  104. func (err ErrKeyAlreadyExist) Error() string {
  105. return fmt.Sprintf("public key already exists [owner_id: %d, content: %s]", err.OwnerID, err.Content)
  106. }
  107. type ErrKeyNameAlreadyUsed struct {
  108. OwnerID int64
  109. Name string
  110. }
  111. func IsErrKeyNameAlreadyUsed(err error) bool {
  112. _, ok := err.(ErrKeyNameAlreadyUsed)
  113. return ok
  114. }
  115. func (err ErrKeyNameAlreadyUsed) Error() string {
  116. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  117. }
  118. type ErrKeyAccessDenied struct {
  119. UserID int64
  120. KeyID int64
  121. Note string
  122. }
  123. func IsErrKeyAccessDenied(err error) bool {
  124. _, ok := err.(ErrKeyAccessDenied)
  125. return ok
  126. }
  127. func (err ErrKeyAccessDenied) Error() string {
  128. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  129. err.UserID, err.KeyID, err.Note)
  130. }
  131. type ErrDeployKeyAlreadyExist struct {
  132. KeyID int64
  133. RepoID int64
  134. }
  135. func IsErrDeployKeyAlreadyExist(err error) bool {
  136. _, ok := err.(ErrDeployKeyAlreadyExist)
  137. return ok
  138. }
  139. func (err ErrDeployKeyAlreadyExist) Error() string {
  140. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  141. }
  142. type ErrDeployKeyNameAlreadyUsed struct {
  143. RepoID int64
  144. Name string
  145. }
  146. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  147. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  148. return ok
  149. }
  150. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  151. return fmt.Sprintf("public key already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  152. }
  153. // ________ .__ __ .__
  154. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  155. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  156. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  157. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  158. // \/ /_____/ \/ \/ \/ \/ \/
  159. type ErrLastOrgOwner struct {
  160. UID int64
  161. }
  162. func IsErrLastOrgOwner(err error) bool {
  163. _, ok := err.(ErrLastOrgOwner)
  164. return ok
  165. }
  166. func (err ErrLastOrgOwner) Error() string {
  167. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  168. }
  169. // __________ .__ __
  170. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  171. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  172. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  173. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  174. // \/ \/|__| \/ \/
  175. type ErrInvalidCloneAddr struct {
  176. IsURLError bool
  177. IsInvalidPath bool
  178. IsPermissionDenied bool
  179. }
  180. func IsErrInvalidCloneAddr(err error) bool {
  181. _, ok := err.(ErrInvalidCloneAddr)
  182. return ok
  183. }
  184. func (err ErrInvalidCloneAddr) Error() string {
  185. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  186. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  187. }
  188. type ErrUpdateTaskNotExist struct {
  189. UUID string
  190. }
  191. func IsErrUpdateTaskNotExist(err error) bool {
  192. _, ok := err.(ErrUpdateTaskNotExist)
  193. return ok
  194. }
  195. func (err ErrUpdateTaskNotExist) Error() string {
  196. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  197. }
  198. type ErrReleaseAlreadyExist struct {
  199. TagName string
  200. }
  201. func IsErrReleaseAlreadyExist(err error) bool {
  202. _, ok := err.(ErrReleaseAlreadyExist)
  203. return ok
  204. }
  205. func (err ErrReleaseAlreadyExist) Error() string {
  206. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  207. }
  208. type ErrInvalidTagName struct {
  209. TagName string
  210. }
  211. func IsErrInvalidTagName(err error) bool {
  212. _, ok := err.(ErrInvalidTagName)
  213. return ok
  214. }
  215. func (err ErrInvalidTagName) Error() string {
  216. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  217. }
  218. type ErrRepoFileAlreadyExist struct {
  219. FileName string
  220. }
  221. func IsErrRepoFileAlreadyExist(err error) bool {
  222. _, ok := err.(ErrRepoFileAlreadyExist)
  223. return ok
  224. }
  225. func (err ErrRepoFileAlreadyExist) Error() string {
  226. return fmt.Sprintf("repository file already exists [file_name: %s]", err.FileName)
  227. }
  228. // ___________
  229. // \__ ___/___ _____ _____
  230. // | |_/ __ \\__ \ / \
  231. // | |\ ___/ / __ \| Y Y \
  232. // |____| \___ >____ /__|_| /
  233. // \/ \/ \/
  234. type ErrTeamAlreadyExist struct {
  235. ID int64
  236. OrgID int64
  237. Name string
  238. }
  239. func IsErrTeamAlreadyExist(err error) bool {
  240. _, ok := err.(ErrTeamAlreadyExist)
  241. return ok
  242. }
  243. func (err ErrTeamAlreadyExist) Error() string {
  244. return fmt.Sprintf("team already exists [id: %d, org_id: %d, name: %s]", err.ID, err.OrgID, err.Name)
  245. }
  246. // ____ ___ .__ .___
  247. // | | \______ | | _________ __| _/
  248. // | | /\____ \| | / _ \__ \ / __ |
  249. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  250. // |______/ | __/|____/\____(____ /\____ |
  251. // |__| \/ \/
  252. //
  253. type ErrUploadNotExist struct {
  254. ID int64
  255. UUID string
  256. }
  257. func IsErrUploadNotExist(err error) bool {
  258. _, ok := err.(ErrAttachmentNotExist)
  259. return ok
  260. }
  261. func (err ErrUploadNotExist) Error() string {
  262. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  263. }
PANIC: session(release): write data/sessions/b/0/b0c4fede23651dc9: no space left on device

PANIC

session(release): write data/sessions/b/0/b0c4fede23651dc9: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)