mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +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 ok {
|
||||||
if status = base.Compare(bl); status == 1 {
|
if status = base.Compare(bl); status == 1 {
|
||||||
p.PutToInvalid(bl, "compare failed")
|
p.PutToInvalid(bl, ErrCompareFailed.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,13 +307,13 @@ func (p *Pool) BaseCompare(bl *pkg.Baseline) {
|
|||||||
bl.Collect()
|
bl.Collect()
|
||||||
for _, f := range bl.Frameworks {
|
for _, f := range bl.Frameworks {
|
||||||
if f.Tag == "waf/cdn" {
|
if f.Tag == "waf/cdn" {
|
||||||
p.PutToInvalid(bl, "waf")
|
p.PutToInvalid(bl, ErrWaf.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok && status == 0 && base.FuzzyCompare(bl) {
|
if ok && status == 0 && base.FuzzyCompare(bl) {
|
||||||
p.PutToInvalid(bl, "fuzzy compare failed")
|
p.PutToInvalid(bl, ErrFuzzyCompareFailed.Error())
|
||||||
p.PutToFuzzy(bl)
|
p.PutToFuzzy(bl)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ const (
|
|||||||
ErrRequestFailed
|
ErrRequestFailed
|
||||||
ErrWaf
|
ErrWaf
|
||||||
ErrRedirect
|
ErrRedirect
|
||||||
|
ErrCompareFailed
|
||||||
|
ErrFuzzyCompareFailed
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e ErrorType) Error() string {
|
func (e ErrorType) Error() string {
|
||||||
@ -22,6 +24,10 @@ func (e ErrorType) Error() string {
|
|||||||
return "maybe ban of waf"
|
return "maybe ban of waf"
|
||||||
case ErrRedirect:
|
case ErrRedirect:
|
||||||
return "duplicate redirect url"
|
return "duplicate redirect url"
|
||||||
|
case ErrCompareFailed:
|
||||||
|
return "compare failed"
|
||||||
|
case ErrFuzzyCompareFailed:
|
||||||
|
return "fuzzy compare failed"
|
||||||
default:
|
default:
|
||||||
return "unknown error"
|
return "unknown error"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user