Skip to content

Commit

Permalink
Update deps (#479)
Browse files Browse the repository at this point in the history
* Update deps
* Update message Encode function to check for errors
* Update SDK
* Wrap error
  • Loading branch information
mostafa authored and sabamosleh12 committed Mar 13, 2024
1 parent 66a0d8c commit 6528699
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
8 changes: 7 additions & 1 deletion act/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,20 @@ func Terminate(_ map[string]any, params ...sdkAct.Parameter) (any, error) {
if _, exists := result["response"]; !exists {
logger.Trace().Fields(result).Msg(
"Terminating without response, returning an error response")
result["response"] = (&pgproto3.Terminate{}).Encode(
response, err := (&pgproto3.Terminate{}).Encode(
postgres.ErrorResponse(
"Request terminated",
"ERROR",
"42000",
"Policy terminated the request",
),
)
if err != nil {
// This should never happen, since everything is hardcoded.
logger.Error().Err(err).Msg("Failed to encode the error response")
return nil, gerr.ErrMsgEncodeError.Wrap(err)
}
result["response"] = response
}

return result, nil
Expand Down
3 changes: 3 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
ErrCodeRunError
ErrCodeAsyncAction
ErrCodeEvalError
ErrCodeMsgEncodeError
)

var (
Expand Down Expand Up @@ -152,6 +153,8 @@ var (
ErrCodeKeyNotFound, "no matching policy", nil)
ErrEvalError = NewGatewayDError(
ErrCodeEvalError, "error evaluating expression", nil)
ErrMsgEncodeError = NewGatewayDError(
ErrCodeMsgEncodeError, "error encoding message", nil)

// Unwrapped errors.
ErrLoggerRequired = errors.New("terminate action requires a logger parameter")
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ require (
github.com/NYTimes/gziphandler v1.1.1
github.com/codingsince1985/checksum v1.3.0
github.com/envoyproxy/protoc-gen-validate v1.0.4
github.com/gatewayd-io/gatewayd-plugin-sdk v0.2.5
github.com/gatewayd-io/gatewayd-plugin-sdk v0.2.6
github.com/getsentry/sentry-go v0.27.0
github.com/go-co-op/gocron v1.37.0
github.com/google/go-github/v53 v53.2.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/hashicorp/go-hclog v1.6.2
github.com/hashicorp/go-plugin v1.6.0
github.com/invopop/jsonschema v0.12.0
github.com/jackc/pgx/v5 v5.5.3
github.com/jackc/pgx/v5 v5.5.4
github.com/knadh/koanf v1.5.0
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.19.0
Expand All @@ -33,7 +33,7 @@ require (
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
google.golang.org/genproto/googleapis/api v0.0.0-20240221002015-b0ce06bbee7c
google.golang.org/genproto/googleapis/api v0.0.0-20240304212257-790db918fca8
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.32.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
Expand Down Expand Up @@ -79,12 +79,11 @@ require (
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect
)
34 changes: 16 additions & 18 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6528699

Please sign in to comment.