mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-28 11:16:31 +08:00
Fix: connector validation error (#18489)
surface connector validation error detail so test connect can return detail error
This commit is contained in:
@@ -391,8 +391,9 @@ func (h *ConnectorHandler) TestConnector(c *gin.Context) {
|
||||
var (
|
||||
valErr *syncerconnector.ConnectorValidationError
|
||||
credErr *syncerconnector.ConnectorMissingCredentialError
|
||||
rateErr *syncerconnector.RateLimitTriedTooManyTimesError
|
||||
)
|
||||
if errors.As(err, &valErr) || errors.As(err, &credErr) {
|
||||
if errors.As(err, &valErr) || errors.As(err, &credErr) || errors.As(err, &rateErr) {
|
||||
common.ResponseWithCodeData(c, common.CodeDataError, false, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -275,6 +275,11 @@ func TestConnectorHandlerTestConnector(t *testing.T) {
|
||||
err: &syncerconnector.ConnectorMissingCredentialError{Message: "REST API (bearer) requires 'token' in credentials"},
|
||||
wantCode: common.CodeDataError,
|
||||
},
|
||||
{
|
||||
name: "rate limit failure",
|
||||
err: &syncerconnector.RateLimitTriedTooManyTimesError{Message: "REST API rate limited"},
|
||||
wantCode: common.CodeDataError,
|
||||
},
|
||||
{
|
||||
name: "unexpected failure",
|
||||
err: fmt.Errorf("boom"),
|
||||
|
||||
Reference in New Issue
Block a user