Fix: connector validation error (#18489)

surface connector validation error detail so test connect can return
detail error
This commit is contained in:
mkaaad
2026-08-19 14:20:18 +08:00
committed by GitHub
parent d648d19137
commit b46180fa2c
6 changed files with 75 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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"),