Skip to content

Commit f174671

Browse files
rodrigozhouyycptt
authored andcommitted
Convert query converter error to invalid argument (#4036)
1 parent d8aaa5f commit f174671

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

common/persistence/visibility/store/sql/visibility_store.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ package sql
2626

2727
import (
2828
"context"
29+
"errors"
2930
"fmt"
3031
"strings"
3132
"time"
@@ -42,6 +43,7 @@ import (
4243
"go.temporal.io/server/common/persistence/sql/sqlplugin"
4344
"go.temporal.io/server/common/persistence/visibility/manager"
4445
"go.temporal.io/server/common/persistence/visibility/store"
46+
"go.temporal.io/server/common/persistence/visibility/store/query"
4547
"go.temporal.io/server/common/resolver"
4648
"go.temporal.io/server/common/searchattribute"
4749
)
@@ -374,6 +376,11 @@ func (s *VisibilityStore) ListWorkflowExecutions(
374376
)
375377
selectFilter, err := converter.BuildSelectStmt(request.PageSize, request.NextPageToken)
376378
if err != nil {
379+
// Convert ConverterError to InvalidArgument and pass through all other errors (which should be only mapper errors).
380+
var converterErr *query.ConverterError
381+
if errors.As(err, &converterErr) {
382+
return nil, converterErr.ToInvalidArgument()
383+
}
377384
return nil, err
378385
}
379386

@@ -447,6 +454,11 @@ func (s *VisibilityStore) CountWorkflowExecutions(
447454
)
448455
selectFilter, err := converter.BuildCountStmt()
449456
if err != nil {
457+
// Convert ConverterError to InvalidArgument and pass through all other errors (which should be only mapper errors).
458+
var converterErr *query.ConverterError
459+
if errors.As(err, &converterErr) {
460+
return nil, converterErr.ToInvalidArgument()
461+
}
450462
return nil, err
451463
}
452464

0 commit comments

Comments
 (0)