error.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 models
  5. import (
  6. "fmt"
  7. )
  8. type ErrNameReserved struct {
  9. Name string
  10. }
  11. func IsErrNameReserved(err error) bool {
  12. _, ok := err.(ErrNameReserved)
  13. return ok
  14. }
  15. func (err ErrNameReserved) Error() string {
  16. return fmt.Sprintf("name is reserved [name: %s]", err.Name)
  17. }
  18. type ErrNamePatternNotAllowed struct {
  19. Pattern string
  20. }
  21. func IsErrNamePatternNotAllowed(err error) bool {
  22. _, ok := err.(ErrNamePatternNotAllowed)
  23. return ok
  24. }
  25. func (err ErrNamePatternNotAllowed) Error() string {
  26. return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
  27. }
  28. // ____ ___
  29. // | | \______ ___________
  30. // | | / ___// __ \_ __ \
  31. // | | /\___ \\ ___/| | \/
  32. // |______//____ >\___ >__|
  33. // \/ \/
  34. type ErrUserAlreadyExist struct {
  35. Name string
  36. }
  37. func IsErrUserAlreadyExist(err error) bool {
  38. _, ok := err.(ErrUserAlreadyExist)
  39. return ok
  40. }
  41. func (err ErrUserAlreadyExist) Error() string {
  42. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  43. }
  44. type ErrEmailAlreadyUsed struct {
  45. Email string
  46. }
  47. func IsErrEmailAlreadyUsed(err error) bool {
  48. _, ok := err.(ErrEmailAlreadyUsed)
  49. return ok
  50. }
  51. func (err ErrEmailAlreadyUsed) Error() string {
  52. return fmt.Sprintf("e-mail has been used [email: %s]", err.Email)
  53. }
  54. type ErrUserOwnRepos struct {
  55. UID int64
  56. }
  57. func IsErrUserOwnRepos(err error) bool {
  58. _, ok := err.(ErrUserOwnRepos)
  59. return ok
  60. }
  61. func (err ErrUserOwnRepos) Error() string {
  62. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  63. }
  64. type ErrUserHasOrgs struct {
  65. UID int64
  66. }
  67. func IsErrUserHasOrgs(err error) bool {
  68. _, ok := err.(ErrUserHasOrgs)
  69. return ok
  70. }
  71. func (err ErrUserHasOrgs) Error() string {
  72. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  73. }
  74. type ErrReachLimitOfRepo struct {
  75. Limit int
  76. }
  77. func IsErrReachLimitOfRepo(err error) bool {
  78. _, ok := err.(ErrReachLimitOfRepo)
  79. return ok
  80. }
  81. func (err ErrReachLimitOfRepo) Error() string {
  82. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  83. }
  84. // __ __.__ __ .__
  85. // / \ / \__| | _|__|
  86. // \ \/\/ / | |/ / |
  87. // \ /| | <| |
  88. // \__/\ / |__|__|_ \__|
  89. // \/ \/
  90. type ErrWikiAlreadyExist struct {
  91. Title string
  92. }
  93. func IsErrWikiAlreadyExist(err error) bool {
  94. _, ok := err.(ErrWikiAlreadyExist)
  95. return ok
  96. }
  97. func (err ErrWikiAlreadyExist) Error() string {
  98. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  99. }
  100. // __________ ___. .__ .__ ____ __.
  101. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  102. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  103. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  104. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  105. // \/ \/ \/ \/\/
  106. type ErrKeyUnableVerify struct {
  107. Result string
  108. }
  109. func IsErrKeyUnableVerify(err error) bool {
  110. _, ok := err.(ErrKeyUnableVerify)
  111. return ok
  112. }
  113. func (err ErrKeyUnableVerify) Error() string {
  114. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  115. }
  116. type ErrKeyNotExist struct {
  117. ID int64
  118. }
  119. func IsErrKeyNotExist(err error) bool {
  120. _, ok := err.(ErrKeyNotExist)
  121. return ok
  122. }
  123. func (err ErrKeyNotExist) Error() string {
  124. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  125. }
  126. type ErrKeyAlreadyExist struct {
  127. OwnerID int64
  128. Content string
  129. }
  130. func IsErrKeyAlreadyExist(err error) bool {
  131. _, ok := err.(ErrKeyAlreadyExist)
  132. return ok
  133. }
  134. func (err ErrKeyAlreadyExist) Error() string {
  135. return fmt.Sprintf("public key already exists [owner_id: %d, content: %s]", err.OwnerID, err.Content)
  136. }
  137. type ErrKeyNameAlreadyUsed struct {
  138. OwnerID int64
  139. Name string
  140. }
  141. func IsErrKeyNameAlreadyUsed(err error) bool {
  142. _, ok := err.(ErrKeyNameAlreadyUsed)
  143. return ok
  144. }
  145. func (err ErrKeyNameAlreadyUsed) Error() string {
  146. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  147. }
  148. type ErrKeyAccessDenied struct {
  149. UserID int64
  150. KeyID int64
  151. Note string
  152. }
  153. func IsErrKeyAccessDenied(err error) bool {
  154. _, ok := err.(ErrKeyAccessDenied)
  155. return ok
  156. }
  157. func (err ErrKeyAccessDenied) Error() string {
  158. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  159. err.UserID, err.KeyID, err.Note)
  160. }
  161. type ErrDeployKeyNotExist struct {
  162. ID int64
  163. KeyID int64
  164. RepoID int64
  165. }
  166. func IsErrDeployKeyNotExist(err error) bool {
  167. _, ok := err.(ErrDeployKeyNotExist)
  168. return ok
  169. }
  170. func (err ErrDeployKeyNotExist) Error() string {
  171. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  172. }
  173. type ErrDeployKeyAlreadyExist struct {
  174. KeyID int64
  175. RepoID int64
  176. }
  177. func IsErrDeployKeyAlreadyExist(err error) bool {
  178. _, ok := err.(ErrDeployKeyAlreadyExist)
  179. return ok
  180. }
  181. func (err ErrDeployKeyAlreadyExist) Error() string {
  182. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  183. }
  184. type ErrDeployKeyNameAlreadyUsed struct {
  185. RepoID int64
  186. Name string
  187. }
  188. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  189. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  190. return ok
  191. }
  192. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  193. return fmt.Sprintf("public key already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  194. }
  195. // _____ ___________ __
  196. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  197. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  198. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  199. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  200. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  201. type ErrAccessTokenNotExist struct {
  202. SHA string
  203. }
  204. func IsErrAccessTokenNotExist(err error) bool {
  205. _, ok := err.(ErrAccessTokenNotExist)
  206. return ok
  207. }
  208. func (err ErrAccessTokenNotExist) Error() string {
  209. return fmt.Sprintf("access token does not exist [sha: %s]", err.SHA)
  210. }
  211. type ErrAccessTokenEmpty struct {
  212. }
  213. func IsErrAccessTokenEmpty(err error) bool {
  214. _, ok := err.(ErrAccessTokenEmpty)
  215. return ok
  216. }
  217. func (err ErrAccessTokenEmpty) Error() string {
  218. return fmt.Sprintf("access token is empty")
  219. }
  220. // ________ .__ __ .__
  221. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  222. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  223. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  224. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  225. // \/ /_____/ \/ \/ \/ \/ \/
  226. type ErrLastOrgOwner struct {
  227. UID int64
  228. }
  229. func IsErrLastOrgOwner(err error) bool {
  230. _, ok := err.(ErrLastOrgOwner)
  231. return ok
  232. }
  233. func (err ErrLastOrgOwner) Error() string {
  234. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  235. }
  236. // __________ .__ __
  237. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  238. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  239. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  240. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  241. // \/ \/|__| \/ \/
  242. type ErrRepoNotExist struct {
  243. ID int64
  244. UID int64
  245. Name string
  246. }
  247. func IsErrRepoNotExist(err error) bool {
  248. _, ok := err.(ErrRepoNotExist)
  249. return ok
  250. }
  251. func (err ErrRepoNotExist) Error() string {
  252. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, name: %s]", err.ID, err.UID, err.Name)
  253. }
  254. type ErrRepoAlreadyExist struct {
  255. Uname string
  256. Name string
  257. }
  258. func IsErrRepoAlreadyExist(err error) bool {
  259. _, ok := err.(ErrRepoAlreadyExist)
  260. return ok
  261. }
  262. func (err ErrRepoAlreadyExist) Error() string {
  263. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  264. }
  265. type ErrInvalidCloneAddr struct {
  266. IsURLError bool
  267. IsInvalidPath bool
  268. IsPermissionDenied bool
  269. }
  270. func IsErrInvalidCloneAddr(err error) bool {
  271. _, ok := err.(ErrInvalidCloneAddr)
  272. return ok
  273. }
  274. func (err ErrInvalidCloneAddr) Error() string {
  275. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  276. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  277. }
  278. type ErrUpdateTaskNotExist struct {
  279. UUID string
  280. }
  281. func IsErrUpdateTaskNotExist(err error) bool {
  282. _, ok := err.(ErrUpdateTaskNotExist)
  283. return ok
  284. }
  285. func (err ErrUpdateTaskNotExist) Error() string {
  286. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  287. }
  288. type ErrReleaseAlreadyExist struct {
  289. TagName string
  290. }
  291. func IsErrReleaseAlreadyExist(err error) bool {
  292. _, ok := err.(ErrReleaseAlreadyExist)
  293. return ok
  294. }
  295. func (err ErrReleaseAlreadyExist) Error() string {
  296. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  297. }
  298. type ErrReleaseNotExist struct {
  299. ID int64
  300. TagName string
  301. }
  302. func IsErrReleaseNotExist(err error) bool {
  303. _, ok := err.(ErrReleaseNotExist)
  304. return ok
  305. }
  306. func (err ErrReleaseNotExist) Error() string {
  307. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  308. }
  309. type ErrInvalidTagName struct {
  310. TagName string
  311. }
  312. func IsErrInvalidTagName(err error) bool {
  313. _, ok := err.(ErrInvalidTagName)
  314. return ok
  315. }
  316. func (err ErrInvalidTagName) Error() string {
  317. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  318. }
  319. type ErrRepoFileAlreadyExist struct {
  320. FileName string
  321. }
  322. func IsErrRepoFileAlreadyExist(err error) bool {
  323. _, ok := err.(ErrRepoFileAlreadyExist)
  324. return ok
  325. }
  326. func (err ErrRepoFileAlreadyExist) Error() string {
  327. return fmt.Sprintf("repository file already exists [file_name: %s]", err.FileName)
  328. }
  329. // __________ .__
  330. // \______ \____________ ____ ____ | |__
  331. // | | _/\_ __ \__ \ / \_/ ___\| | \
  332. // | | \ | | \// __ \| | \ \___| Y \
  333. // |______ / |__| (____ /___| /\___ >___| /
  334. // \/ \/ \/ \/ \/
  335. type ErrBranchNotExist struct {
  336. Name string
  337. }
  338. func IsErrBranchNotExist(err error) bool {
  339. _, ok := err.(ErrBranchNotExist)
  340. return ok
  341. }
  342. func (err ErrBranchNotExist) Error() string {
  343. return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
  344. }
  345. // __ __ ___. .__ __
  346. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  347. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  348. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  349. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  350. // \/ \/ \/ \/ \/
  351. type ErrWebhookNotExist struct {
  352. ID int64
  353. }
  354. func IsErrWebhookNotExist(err error) bool {
  355. _, ok := err.(ErrWebhookNotExist)
  356. return ok
  357. }
  358. func (err ErrWebhookNotExist) Error() string {
  359. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  360. }
  361. // .___
  362. // | | ______ ________ __ ____
  363. // | |/ ___// ___/ | \_/ __ \
  364. // | |\___ \ \___ \| | /\ ___/
  365. // |___/____ >____ >____/ \___ >
  366. // \/ \/ \/
  367. type ErrIssueNotExist struct {
  368. ID int64
  369. RepoID int64
  370. Index int64
  371. }
  372. func IsErrIssueNotExist(err error) bool {
  373. _, ok := err.(ErrIssueNotExist)
  374. return ok
  375. }
  376. func (err ErrIssueNotExist) Error() string {
  377. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  378. }
  379. // __________ .__ .__ __________ __
  380. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  381. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  382. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  383. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  384. // \/ \/ |__| \/ \/
  385. type ErrPullRequestNotExist struct {
  386. ID int64
  387. IssueID int64
  388. HeadRepoID int64
  389. BaseRepoID int64
  390. HeadBarcnh string
  391. BaseBranch string
  392. }
  393. func IsErrPullRequestNotExist(err error) bool {
  394. _, ok := err.(ErrPullRequestNotExist)
  395. return ok
  396. }
  397. func (err ErrPullRequestNotExist) Error() string {
  398. return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
  399. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
  400. }
  401. // _________ __
  402. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  403. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  404. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  405. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  406. // \/ \/ \/ \/ \/
  407. type ErrCommentNotExist struct {
  408. ID int64
  409. IssueID int64
  410. }
  411. func IsErrCommentNotExist(err error) bool {
  412. _, ok := err.(ErrCommentNotExist)
  413. return ok
  414. }
  415. func (err ErrCommentNotExist) Error() string {
  416. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  417. }
  418. // .____ ___. .__
  419. // | | _____ \_ |__ ____ | |
  420. // | | \__ \ | __ \_/ __ \| |
  421. // | |___ / __ \| \_\ \ ___/| |__
  422. // |_______ (____ /___ /\___ >____/
  423. // \/ \/ \/ \/
  424. type ErrLabelNotExist struct {
  425. LabelID int64
  426. RepoID int64
  427. }
  428. func IsErrLabelNotExist(err error) bool {
  429. _, ok := err.(ErrLabelNotExist)
  430. return ok
  431. }
  432. func (err ErrLabelNotExist) Error() string {
  433. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  434. }
  435. // _____ .__.__ __
  436. // / \ |__| | ____ _______/ |_ ____ ____ ____
  437. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  438. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  439. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  440. // \/ \/ \/ \/ \/
  441. type ErrMilestoneNotExist struct {
  442. ID int64
  443. RepoID int64
  444. }
  445. func IsErrMilestoneNotExist(err error) bool {
  446. _, ok := err.(ErrMilestoneNotExist)
  447. return ok
  448. }
  449. func (err ErrMilestoneNotExist) Error() string {
  450. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  451. }
  452. // _____ __ __ .__ __
  453. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  454. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  455. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  456. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  457. // \/ \/ \/ \/ \/ \/ \/
  458. type ErrAttachmentNotExist struct {
  459. ID int64
  460. UUID string
  461. }
  462. func IsErrAttachmentNotExist(err error) bool {
  463. _, ok := err.(ErrAttachmentNotExist)
  464. return ok
  465. }
  466. func (err ErrAttachmentNotExist) Error() string {
  467. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  468. }
  469. // .____ .__ _________
  470. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  471. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  472. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  473. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  474. // \/ /_____/ \/ \/ \/ \/
  475. type ErrLoginSourceNotExist struct {
  476. ID int64
  477. }
  478. func IsErrLoginSourceNotExist(err error) bool {
  479. _, ok := err.(ErrLoginSourceNotExist)
  480. return ok
  481. }
  482. func (err ErrLoginSourceNotExist) Error() string {
  483. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  484. }
  485. type ErrLoginSourceAlreadyExist struct {
  486. Name string
  487. }
  488. func IsErrLoginSourceAlreadyExist(err error) bool {
  489. _, ok := err.(ErrLoginSourceAlreadyExist)
  490. return ok
  491. }
  492. func (err ErrLoginSourceAlreadyExist) Error() string {
  493. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  494. }
  495. type ErrLoginSourceInUse struct {
  496. ID int64
  497. }
  498. func IsErrLoginSourceInUse(err error) bool {
  499. _, ok := err.(ErrLoginSourceInUse)
  500. return ok
  501. }
  502. func (err ErrLoginSourceInUse) Error() string {
  503. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  504. }
  505. // ___________
  506. // \__ ___/___ _____ _____
  507. // | |_/ __ \\__ \ / \
  508. // | |\ ___/ / __ \| Y Y \
  509. // |____| \___ >____ /__|_| /
  510. // \/ \/ \/
  511. type ErrTeamAlreadyExist struct {
  512. OrgID int64
  513. Name string
  514. }
  515. func IsErrTeamAlreadyExist(err error) bool {
  516. _, ok := err.(ErrTeamAlreadyExist)
  517. return ok
  518. }
  519. func (err ErrTeamAlreadyExist) Error() string {
  520. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  521. }
  522. // ____ ___ .__ .___
  523. // | | \______ | | _________ __| _/
  524. // | | /\____ \| | / _ \__ \ / __ |
  525. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  526. // |______/ | __/|____/\____(____ /\____ |
  527. // |__| \/ \/
  528. //
  529. type ErrUploadNotExist struct {
  530. ID int64
  531. UUID string
  532. }
  533. func IsErrUploadNotExist(err error) bool {
  534. _, ok := err.(ErrAttachmentNotExist)
  535. return ok
  536. }
  537. func (err ErrUploadNotExist) Error() string {
  538. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  539. }