mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
优化错误处理
This commit is contained in:
parent
7d67e81cb0
commit
bfda87826a
@ -299,7 +299,7 @@ func (p *Pool) BaseCompare(bl *pkg.Baseline) {
|
||||
|
||||
if ok {
|
||||
if status = base.Compare(bl); status == 1 {
|
||||
p.PutToInvalid(bl, "compare failed")
|
||||
p.PutToInvalid(bl, ErrCompareFailed.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -307,13 +307,13 @@ func (p *Pool) BaseCompare(bl *pkg.Baseline) {
|
||||
bl.Collect()
|
||||
for _, f := range bl.Frameworks {
|
||||
if f.Tag == "waf/cdn" {
|
||||
p.PutToInvalid(bl, "waf")
|
||||
p.PutToInvalid(bl, ErrWaf.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ok && status == 0 && base.FuzzyCompare(bl) {
|
||||
p.PutToInvalid(bl, "fuzzy compare failed")
|
||||
p.PutToInvalid(bl, ErrFuzzyCompareFailed.Error())
|
||||
p.PutToFuzzy(bl)
|
||||
return
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ const (
|
||||
ErrRequestFailed
|
||||
ErrWaf
|
||||
ErrRedirect
|
||||
ErrCompareFailed
|
||||
ErrFuzzyCompareFailed
|
||||
)
|
||||
|
||||
func (e ErrorType) Error() string {
|
||||
@ -22,6 +24,10 @@ func (e ErrorType) Error() string {
|
||||
return "maybe ban of waf"
|
||||
case ErrRedirect:
|
||||
return "duplicate redirect url"
|
||||
case ErrCompareFailed:
|
||||
return "compare failed"
|
||||
case ErrFuzzyCompareFailed:
|
||||
return "fuzzy compare failed"
|
||||
default:
|
||||
return "unknown error"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user