mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-11 14:15:40 +08:00
24 lines
508 B
Go
24 lines
508 B
Go
package httputil
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"ragflow/internal/common"
|
|
"ragflow/internal/service"
|
|
)
|
|
|
|
func IngestionTaskErrorCode(err error) common.ErrorCode {
|
|
var transitionErr *service.InvalidTaskTransitionError
|
|
if errors.As(err, &transitionErr) {
|
|
return common.CodeConflict
|
|
}
|
|
var conflictErr *service.TaskStatusConflictError
|
|
if errors.As(err, &conflictErr) {
|
|
return common.CodeConflict
|
|
}
|
|
if errors.Is(err, common.ErrTaskNotFound) {
|
|
return common.CodeNotFound
|
|
}
|
|
return common.CodeExceptionError
|
|
}
|