error.go 17 KB

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