mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-21 23:21:04 +08:00
Feat: add built in DSL file API (#17003)
### Summary 1. list and get by id API for builtin DSL 2. add DSL default component param values validation 3. remove all hard code keys for parser config
This commit is contained in:
43
internal/handler/error_test.go
Normal file
43
internal/handler/error_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"ragflow/internal/common"
|
||||
"ragflow/internal/service"
|
||||
)
|
||||
|
||||
func TestIngestionTaskErrorCode(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
err error
|
||||
want common.ErrorCode
|
||||
}{
|
||||
{
|
||||
name: "invalid transition",
|
||||
err: &service.InvalidTaskTransitionError{TaskID: "task-1", From: common.CREATED, To: common.COMPLETED},
|
||||
want: common.CodeConflict,
|
||||
},
|
||||
{
|
||||
name: "status conflict",
|
||||
err: &service.TaskStatusConflictError{TaskID: "task-1", ExpectedFrom: common.CREATED, AttemptedTo: common.RUNNING, ActualCurrent: common.STOPPING},
|
||||
want: common.CodeConflict,
|
||||
},
|
||||
{
|
||||
name: "task not found",
|
||||
err: common.ErrTaskNotFound,
|
||||
want: common.CodeNotFound,
|
||||
},
|
||||
{
|
||||
name: "fallback",
|
||||
err: common.ErrInvalidToken,
|
||||
want: common.CodeExceptionError,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
if got := IngestionTaskErrorCode(tc.err); got != tc.want {
|
||||
t.Fatalf("%s: got %d, want %d", tc.name, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user