MCPcopy Index your code
hub / github.com/aws/aws-lambda-go / TestCustomError

Function TestCustomError

lambda/rpc_function_test.go:95–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93func (e CustomError) Error() string { return "Something bad happened!" }
94
95func TestCustomError(t *testing.T) {
96 srv := NewFunction(testWrapperHandler(
97 func(ctx context.Context, input []byte) (interface{}, error) {
98 return nil, CustomError{}
99 },
100 ))
101 var response messages.InvokeResponse
102 err := srv.Invoke(&messages.InvokeRequest{}, &response)
103 assert.NoError(t, err)
104 assert.Nil(t, response.Payload)
105 assert.Equal(t, "Something bad happened!", response.Error.Message)
106 assert.Equal(t, "CustomError", response.Error.Type)
107}
108
109type CustomError2 struct{}
110

Callers

nothing calls this directly

Calls 3

InvokeMethod · 0.95
NewFunctionFunction · 0.85
testWrapperHandlerFuncType · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…