| 1 | import { HttpStatus } from '@nestjs/common'; |
| 2 | import { DomainError } |
| 3 | |
| 4 | export class WalCorruptError |
| 5 | status: number |
| 6 | |
| 7 | constructor(detail: |
| 8 | super(`Write-ahead log is corrupt: ${detail |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | export class NonFastForwardError |
| 13 | status: number |
| 14 | |
| 15 | constructor(readonly ref |
| 16 | super( |
| 17 | `Updates were rejected because the remote contains work you do not have locally: ${ref}`, |
| 18 | ); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | export class WalContentionError |
| 23 | status: number |
| 24 | |
| 25 | constructor(repoId: |
| 26 | super(`Too many concurrent pushes to ${repoId |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** The index is a tombstone. Reads as absent, like a repository that never existed. */ |
| 31 | export class RepositoryDeletedError |
| 32 | status: number |
| 33 | |
| 34 | constructor() { |
| 35 | super('Repository not found'); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** A ref the log must never hold: git refuses it on replay, so every node materializing the repository would stop at it for good. */ |
| 40 | export class UnreplayableRefError |
| 41 | status: number |
| 42 | |
| 43 | constructor( |
| 44 | readonly ref: |
| 45 | reason: string, |
| 46 | ) { |
| 47 | super(`${ref} |
| 48 | } |
| 49 | } |