-
Notifications
You must be signed in to change notification settings - Fork 731
Expand file tree
/
Copy patherrors.py
More file actions
167 lines (114 loc) · 4.65 KB
/
Copy patherrors.py
File metadata and controls
167 lines (114 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from dataclasses import dataclass
from crowdgit.enums import ErrorCode
@dataclass
class CrowdGitError(Exception):
error_message: str = "An unknown error occurred"
error_code: ErrorCode | None = ErrorCode.UNKNOWN
ai_cost: int | None = 0
@dataclass
class InternalError(CrowdGitError):
error_message: str = "Internal error"
error_code: ErrorCode = ErrorCode.INTERNAL
@dataclass
class UnkownError(CrowdGitError):
error_message: str = "Unkown error"
error_code: ErrorCode = ErrorCode.UNKNOWN
@dataclass
class RepoLockingError(CrowdGitError):
error_message: str = "Cannot acquire repo lock to start processing"
error_code: ErrorCode = ErrorCode.INTERNAL
@dataclass
class CommandTimeoutError(CrowdGitError):
error_message: str = "Command execution timed out"
error_code: ErrorCode = ErrorCode.SHELL_COMMAND_TIMEOUT
@dataclass
class DiskSpaceError(CrowdGitError):
error_message: str = "Insufficient disk space"
error_code: ErrorCode = ErrorCode.DISK_SPACE
@dataclass
class NetworkError(CrowdGitError):
error_message: str = "Network connection error"
error_code: ErrorCode = ErrorCode.NETWORK_ERROR
@dataclass
class RepoPermissionError(CrowdGitError):
error_message: str = "Permission denied"
error_code: ErrorCode = ErrorCode.PERMISSION_ERROR
@dataclass
class CommandExecutionError(CrowdGitError):
error_message: str = "Command execution failed"
error_code: ErrorCode = ErrorCode.SHELL_COMMAND_FAILED
returncode: int | None = None
@dataclass
class CloneError(CrowdGitError):
error_message: str = "Failed to clone repository"
error_code: ErrorCode = ErrorCode.INTERNAL
@dataclass
class QueueConnectionError(CrowdGitError):
error_message: str = "Failed to connect to queue"
error_code: ErrorCode = ErrorCode.QUEUE_CONNECTION_ERROR
@dataclass
class QueueMessageProduceError(CrowdGitError):
error_message: str = "Failed to emit message to queue"
error_code: ErrorCode = ErrorCode.QUEUE_EMIT_ERROR
@dataclass
class ValidationError(CrowdGitError):
error_message: str = "Failed to parse/validate repo field(s)"
error_code: ErrorCode = ErrorCode.VALIDATION
@dataclass
class MaintainerFileNotFoundError(CrowdGitError):
error_message: str = "No maintainer file found"
error_code: ErrorCode = ErrorCode.NO_MAINTAINER_FILE
ai_cost: int = 0
@dataclass
class MaintanerAnalysisError(CrowdGitError):
error_message: str = "Failed to analyze maintainer file content"
error_code: ErrorCode = ErrorCode.MAINTAINER_ANALYSIS_FAILED
ai_cost: int = 0
@dataclass
class MaintainerIntervalNotElapsedError(CrowdGitError):
error_message: str = "Maintainer processing interval has not elapsed yet"
error_code: ErrorCode = ErrorCode.MAINTAINER_INTERVAL_NOT_ELAPSED
ai_cost: int = 0
@dataclass
class AffiliationFileNotFoundError(CrowdGitError):
error_message: str = "No affiliation file found in this repository"
error_code: ErrorCode = ErrorCode.NO_AFFILIATION_FILE
ai_cost: float = 0.0
@dataclass
class AffiliationAnalysisError(CrowdGitError):
error_message: str = "Could not parse the affiliation file"
error_code: ErrorCode = ErrorCode.AFFILIATION_ANALYSIS_FAILED
retain_file_hash: bool = False
@dataclass
class AffiliationIntervalNotElapsedError(CrowdGitError):
error_message: str = "Too soon since the last affiliation run"
error_code: ErrorCode = ErrorCode.AFFILIATION_INTERVAL_NOT_ELAPSED
ai_cost: float = 0.0
@dataclass
class ParentRepoInvalidError(CrowdGitError):
error_message: str = "Parent repository is not valid or not found"
error_code: ErrorCode = ErrorCode.PARENT_REPO_INVALID
@dataclass
class ReOnboardingRequiredError(CrowdGitError):
error_message = "Repository cannot be processed and requires re-onboarding"
error_code: ErrorCode = ErrorCode.REONBOARDING_REQUIRED
@dataclass
class RepoAuthRequiredError(CrowdGitError):
error_message: str = "Repository requires authentication (likely private or deleted)"
error_code: ErrorCode = ErrorCode.REPO_AUTH_REQUIRED
@dataclass
class RateLimitError(CrowdGitError):
error_message: str = "Rate limited by remote server"
error_code: ErrorCode = ErrorCode.RATE_LIMITED
@dataclass
class ForbiddenError(CrowdGitError):
error_message: str = "Access to repository is forbidden"
error_code: ErrorCode = ErrorCode.ACCESS_FORBIDDEN
@dataclass
class RemoteServerError(CrowdGitError):
error_message: str = "Remote server returned an internal error"
error_code: ErrorCode = ErrorCode.SERVER_ERROR
@dataclass
class EmptyRepoError(CrowdGitError):
error_message: str = "Repository is empty (no branches or commits)"
error_code: ErrorCode = ErrorCode.EMPTY_REPO