Files
ragflow/internal/httputil/ingestion_task_error.go

24 lines
508 B
Go
Raw Normal View History

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
}