getErrorCategory returns the error category from an error. It checks for TLS, auth, network, and server errors.
(err error)
| 360 | // getErrorCategory returns the error category from an error. |
| 361 | // It checks for TLS, auth, network, and server errors. |
| 362 | func getErrorCategory(err error) string { |
| 363 | if err == nil { |
| 364 | return "" |
| 365 | } |
| 366 | |
| 367 | errStr := err.Error() |
| 368 | |
| 369 | // For actual errors, also check error types |
| 370 | if isNetworkError(err) || isTimeoutError(err) { |
| 371 | return "network" |
| 372 | } |
| 373 | |
| 374 | // Check for Redis server errors by prefix |
| 375 | if prefix := extractRedisErrorPrefix(err); prefix != "" { |
| 376 | return "server" |
| 377 | } |
| 378 | |
| 379 | return getErrorCategoryFromString(errStr) |
| 380 | } |
| 381 | |
| 382 | // getErrorCategoryFromString returns the error category from an error string or error type. |
| 383 | // This is used both by getErrorCategory (for errors) and directly for error type strings. |
no test coverage detected