Commit c8b9251
authored
feat(storage): improve error messages with actionable suggestions (#102)
* feat(storage): improve error messages with actionable suggestions
- Add NXM-STOR-xxx error codes for programmatic handling
- Include context-aware suggestions for common errors
- Implement 'Did you mean?' feature using Levenshtein distance
- Add comprehensive documentation and test coverage
- Improve error formatting for better readability
- Maintain backward compatibility with existing code
* fix(executor): use KeyNotFound error for table lookup failures
- Replace ReadError with key_not_found for table not found cases
- Provide proper error code NXM-STOR-104 instead of NXM-STOR-103
- Add context to table lookup errors (SELECT, UPDATE, DELETE, etc.)
- Improves error clarity for users when tables don't exist
* chore(storage): export find_similar_keys for fuzzy matching
- Export find_similar_keys function from error module
- Enables 'Did you mean?' suggestions across the codebase
- Required for table name fuzzy matching in executor
* chore: run cargo fmt and clippy
* fix(storage): refine KeyNotFound wording and sled Io error mapping
- Adjust suggestion text to handle singular vs plural similar keys
- Use open_error for sled::Error::Io to avoid mislabeling read-path failures
Signed-off-by: noor05-creator <noorasif.noor05@gmail.com>
* chore(executor): import find_similar_keys to simplify call sites
Signed-off-by: noor05-creator <noorasif.noor05@gmail.com>
---------
Signed-off-by: noor05-creator <noorasif.noor05@gmail.com>1 parent d4b8d3d commit c8b9251
3 files changed
Lines changed: 546 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
212 | 223 | | |
213 | 224 | | |
214 | 225 | | |
| |||
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
226 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
227 | 243 | | |
228 | 244 | | |
229 | 245 | | |
| |||
245 | 261 | | |
246 | 262 | | |
247 | 263 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
252 | 272 | | |
253 | 273 | | |
254 | 274 | | |
| |||
316 | 336 | | |
317 | 337 | | |
318 | 338 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
323 | 347 | | |
324 | 348 | | |
325 | 349 | | |
| |||
0 commit comments