errors.ts raw
1 /**
2 * Domain errors for Social bounded context
3 */
4
5 import { DomainError } from '../shared'
6
7 /**
8 * Thrown when attempting to follow oneself
9 */
10 export class CannotFollowSelfError extends DomainError {
11 constructor() {
12 super('Cannot follow yourself')
13 }
14 }
15
16 /**
17 * Thrown when attempting to mute oneself
18 */
19 export class CannotMuteSelfError extends DomainError {
20 constructor() {
21 super('Cannot mute yourself')
22 }
23 }
24
25 /**
26 * Thrown when attempting to perform an operation that requires authentication
27 */
28 export class NotAuthenticatedError extends DomainError {
29 constructor() {
30 super('Authentication required for this operation')
31 }
32 }
33
34 /**
35 * Thrown when a follow list operation fails
36 */
37 export class FollowListOperationError extends DomainError {
38 constructor(operation: string, reason?: string) {
39 super(`Follow list operation failed: ${operation}${reason ? ` - ${reason}` : ''}`)
40 }
41 }
42
43 /**
44 * Thrown when a mute list operation fails
45 */
46 export class MuteListOperationError extends DomainError {
47 constructor(operation: string, reason?: string) {
48 super(`Mute list operation failed: ${operation}${reason ? ` - ${reason}` : ''}`)
49 }
50 }
51