diff --git a/pkg/sql/flowinfra/BUILD.bazel b/pkg/sql/flowinfra/BUILD.bazel index 53c5461c4f1e..2f28e7419d39 100644 --- a/pkg/sql/flowinfra/BUILD.bazel +++ b/pkg/sql/flowinfra/BUILD.bazel @@ -43,6 +43,7 @@ go_library( "//pkg/util/uuid", "@com_github_cockroachdb_errors//:errors", "@com_github_cockroachdb_redact//:redact", + "@com_github_gogo_protobuf//proto", "@io_opentelemetry_go_otel//attribute", ], ) diff --git a/pkg/sql/flowinfra/flow_registry.go b/pkg/sql/flowinfra/flow_registry.go index 687d95978399..497e03284c76 100644 --- a/pkg/sql/flowinfra/flow_registry.go +++ b/pkg/sql/flowinfra/flow_registry.go @@ -12,7 +12,6 @@ package flowinfra import ( "context" - "fmt" "sync" "time" @@ -25,6 +24,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/tracing" "github.com/cockroachdb/errors" "github.com/cockroachdb/redact" + "github.com/gogo/protobuf/proto" ) // errNoInboundStreamConnection is the error propagated through the flow when @@ -239,8 +239,20 @@ type flowRetryableError struct { cause error } -func (e *flowRetryableError) Error() string { - return fmt.Sprintf("flow retryable error: %+v", e.cause) +var _ errors.Wrapper = &flowRetryableError{} + +func (e *flowRetryableError) Error() string { return e.cause.Error() } +func (e *flowRetryableError) Cause() error { return e.cause } +func (e *flowRetryableError) Unwrap() error { return e.Cause() } + +func decodeFlowRetryableError( + _ context.Context, cause error, _ string, _ []string, _ proto.Message, +) error { + return &flowRetryableError{cause: cause} +} + +func init() { + errors.RegisterWrapperDecoder(errors.GetTypeKey((*flowRetryableError)(nil)), decodeFlowRetryableError) } // IsFlowRetryableError returns true if an error represents a retryable diff --git a/pkg/testutils/lint/lint_test.go b/pkg/testutils/lint/lint_test.go index 5060e90d7cca..6546de9ebe03 100644 --- a/pkg/testutils/lint/lint_test.go +++ b/pkg/testutils/lint/lint_test.go @@ -1175,6 +1175,7 @@ func TestLint(t *testing.T) { ":!spanconfig/errors.go", ":!roachpb/replica_unavailable_error.go", ":!roachpb/ambiguous_result_error.go", + ":!sql/flowinfra/flow_registry.go", ":!sql/pgwire/pgerror/constraint_name.go", ":!sql/pgwire/pgerror/severity.go", ":!sql/pgwire/pgerror/with_candidate_code.go",