| 1 | import { HttpStatus } from '@nestjs/common'; |
| 2 | |
| 3 | import { DomainError } |
| 4 | |
| 5 | export class GitHubImportsDisabledError |
| 6 | status: number |
| 7 | |
| 8 | constructor() { |
| 9 | super('GitHub imports are not configured on this instance'); |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | export class GitHubNotConnectedError |
| 14 | status: number |
| 15 | |
| 16 | constructor() { |
| 17 | super('Connect your GitHub account before importing a repository'); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | export class GitHubRepositoryNotFoundError |
| 22 | status: number |
| 23 | |
| 24 | constructor(source: |
| 25 | super( |
| 26 | `GitHub repository ${source} was not found, or your GitHub account cannot read it` |
| 27 | ); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export class GitHubUnavailableError |
| 32 | status: number |
| 33 | |
| 34 | constructor(options: |
| 35 | super('GitHub could not be reached, try again shortly', |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export class ImportNotFoundError |
| 40 | status: number |
| 41 | |
| 42 | constructor() { |
| 43 | super('This repository was not imported'); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export class ImportNotFailedError |
| 48 | status: number |
| 49 | |
| 50 | constructor() { |
| 51 | super('Only a failed import can be retried'); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** The API moved on to another attempt, or the import is gone; the importer stops when it sees this. */ |
| 56 | export class StaleImportAttemptError |
| 57 | status: number |
| 58 | |
| 59 | constructor() { |
| 60 | super('This import attempt is no longer current'); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** A retry writes GitHub's issue numbers over whatever holds them, so it is refused once people have opened issues of their own. */ |
| 65 | export class ImportRetryWouldOverwriteError |
| 66 | status: number |
| 67 | |
| 68 | constructor() { |
| 69 | super( |
| 70 | 'Issues or pull requests were opened here after the import failed, and retrying it would overwrite them', |
| 71 | ); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | export class RepositoryImportingError |
| 76 | status: number |
| 77 | |
| 78 | constructor() { |
| 79 | super('This repository is still being imported from GitHub'); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | export class ImporterUnavailableError |
| 84 | constructor(options: |
| 85 | super('The importer did not accept the job', |
| 86 | } |
| 87 | } |