| 1 | import { HttpStatus } from '@nestjs/common'; |
| 2 | |
| 3 | import { DomainError } |
| 4 | |
| 5 | export class OrganizationNotFoundError |
| 6 | status: number |
| 7 | |
| 8 | constructor(slug: |
| 9 | super(`Organization not found: ${slug |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | export class OrganizationForbiddenError |
| 14 | status: number |
| 15 | |
| 16 | constructor() { |
| 17 | super('The organization does not allow you to do that'); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | /** Better Auth turned an invitation down, for a reason worth passing on as it gave it: already a member, already invited, or no permission. */ |
| 22 | export class InvitationRefusedError |
| 23 | constructor( |
| 24 | readonly status: |
| 25 | message: string, |
| 26 | ) { |
| 27 | super(message); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export class PrivateForkingDisabledError |
| 32 | status: number |
| 33 | |
| 34 | constructor() { |
| 35 | super('This organization does not allow forking its private repositories'); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export class TeamNotFoundError |
| 40 | status: number |
| 41 | |
| 42 | constructor() { |
| 43 | super('Team not found'); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export class UserNotInOrganizationError |
| 48 | status: number |
| 49 | |
| 50 | constructor(username: |
| 51 | super(`${username} |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** Worded as GitHub words it, so a tool built for GitHub shows its user the same explanation. */ |
| 56 | export class OauthAppRestrictedError |
| 57 | status: number |
| 58 | |
| 59 | constructor(slug: |
| 60 | super( |
| 61 | `Although you appear to have the correct authorization credentials, the \`${slug}\` |
| 62 | ); |
| 63 | } |
| 64 | } |