Files
gpt-load/internal/errors/uncounted_errors.go
T
0bcc068cb8 refactor: 规范错误处理 (#202)
* solve Fix: resource has been exhausted counted as failure count

* solve Fix: resource has been exhausted counted as failure count

* Update provider.go

* Update provider.go

* Update provider.go

* fix

* fix2

* fix

* feat: uncount error

* refactor: 规范错误处理

* fix: 简化判断

* feat: 调整错误处理顺序

* docs: 增加备注

---------

Co-authored-by: kikii16 <3372550@gmail.com>
Co-authored-by: kiki <40960890+vickyyd@users.noreply.github.com>
2025-08-21 22:02:20 +08:00

27 lines
549 B
Go

package errors
import "strings"
// unCountedSubstrings contains a list of substrings that indicate an error
var unCountedSubstrings = []string{
"resource has been exhausted",
"please reduce the length of the messages",
}
// IsUnCounted checks if the given error message contains substrings
func IsUnCounted(errorMsg string) bool {
if errorMsg == "" {
return false
}
errorLower := strings.ToLower(errorMsg)
for _, pattern := range unCountedSubstrings {
if strings.Contains(errorLower, pattern) {
return true
}
}
return false
}