Commit 1dd796d
authored
refactor(errors): Replace string pattern matching with SDK error types (#18)
- Add sentinel field to BaseError for single Is() method implementation
- Remove 10 boilerplate Is() methods from concrete error types
- Simplify constructors by removing redundant message parameter
- Delete fragile string pattern matching (Convert(), ConvertWithRegex())
- Add provider-specific ConvertError() methods using SDK error types
- Add ErrorConverter interface for consistent error handling across providers
- Add error code constants (CodeRateLimit, CodeAuthError, etc.)
- Add comprehensive table-driven tests for error conversion1 parent d078506 commit 1dd796d
File tree
8 files changed
+765
-298
lines changed- errors
- providers
- anthropic
- openai
8 files changed
+765
-298
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | 135 | | |
| 136 | + | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
179 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
180 | 209 | | |
181 | 210 | | |
182 | 211 | | |
| |||
234 | 263 | | |
235 | 264 | | |
236 | 265 | | |
237 | | - | |
| 266 | + | |
238 | 267 | | |
239 | 268 | | |
240 | 269 | | |
| |||
0 commit comments