MCPcopy
hub / github.com/aws/aws-lambda-go / TestCustomErrorRef

Function TestCustomErrorRef

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

Source from the content-addressed store, hash-verified

111func (e *CustomError2) Error() string { return "Something bad happened!" }
112
113func TestCustomErrorRef(t *testing.T) {
114
115 srv := NewFunction(testWrapperHandler(
116 func(ctx context.Context, input []byte) (interface{}, error) {
117 return nil, &CustomError2{}
118 },
119 ))
120 var response messages.InvokeResponse
121 err := srv.Invoke(&messages.InvokeRequest{}, &response)
122 assert.NoError(t, err)
123 assert.Nil(t, response.Payload)
124 assert.Equal(t, "Something bad happened!", response.Error.Message)
125 assert.Equal(t, "CustomError2", response.Error.Type)
126}
127
128func TestContextPlumbing(t *testing.T) {
129 srv := NewFunction(testWrapperHandler(

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…