feat: add exit code LoopActionNotFoundError

This commit is contained in:
lilong.129
2023-06-01 17:11:34 +08:00
parent f4a9be3c88
commit 233d5e1b64
2 changed files with 8 additions and 6 deletions

View File

@@ -80,11 +80,12 @@ var (
// OCR related: [80, 90) // OCR related: [80, 90)
var ( var (
OCREnvMissedError = errors.New("OCR env missed error") // 80 OCREnvMissedError = errors.New("OCR env missed error") // 80
OCRRequestError = errors.New("OCR prepare request error") // 81 OCRRequestError = errors.New("OCR prepare request error") // 81
OCRServiceConnectionError = errors.New("OCR service connect error") // 82 OCRServiceConnectionError = errors.New("OCR service connect error") // 82
OCRResponseError = errors.New("OCR parse response error") // 83 OCRResponseError = errors.New("OCR parse response error") // 83
OCRTextNotFoundError = errors.New("OCR text not found") // 84 OCRTextNotFoundError = errors.New("OCR text not found") // 84
LoopActionNotFoundError = errors.New("loop action not found error") // 85
) )
// CV related: [90, 100) // CV related: [90, 100)
@@ -146,6 +147,7 @@ var errorsMap = map[error]int{
OCRServiceConnectionError: 82, OCRServiceConnectionError: 82,
OCRResponseError: 83, OCRResponseError: 83,
OCRTextNotFoundError: 84, OCRTextNotFoundError: 84,
LoopActionNotFoundError: 85,
} }
func IsErrorPredefined(err error) bool { func IsErrorPredefined(err error) bool {

View File

@@ -84,7 +84,7 @@ func (dExt *DriverExt) LoopUntil(findAction, findCondition, foundAction Action,
time.Sleep(time.Duration(1000*interval) * time.Millisecond) time.Sleep(time.Duration(1000*interval) * time.Millisecond)
} }
return errors.Wrap(code.OCRTextNotFoundError, return errors.Wrap(code.LoopActionNotFoundError,
fmt.Sprintf("loop %d times, match find condition failed", maxRetryTimes)) fmt.Sprintf("loop %d times, match find condition failed", maxRetryTimes))
} }