@@ -73,17 +73,26 @@ type InvokeScheduler interface {
73
73
// invocations of a custom resource and MakeTestEventFunc is the entry point that
74
74
// allows the CLI's contract testing framework to invoke the resource's CRUDL handlers.
75
75
func Start (h Handler ) {
76
+ defer func () {
77
+ if r := recover (); r != nil {
78
+ log .Printf ("Handler panicked: %s" , r )
79
+ panic (r ) // Continue the panic
80
+ }
81
+ }()
76
82
77
83
// MODE is an environment variable that is set ONLY
78
84
// when contract test are performed.
79
85
mode , _ := os .LookupEnv ("MODE" )
80
86
81
87
if mode == "Test" {
88
+ log .Printf ("Handler starting in test mode" )
82
89
lambda .Start (makeTestEventFunc (h ))
83
90
} else {
91
+ log .Printf ("Handler starting" )
84
92
lambda .Start (makeEventFunc (h ))
85
93
}
86
94
95
+ log .Printf ("Handler finished" )
87
96
}
88
97
89
98
// Tags are stored as key/value paired strings
@@ -253,6 +262,7 @@ func makeEventFunc(h Handler) eventFunc {
253
262
re := newReportErr (callbackAdapter , metricsPublisher )
254
263
255
264
handlerFn , err := router (event .Action , h )
265
+ log .Printf ("Handler received the %s action" , event .Action )
256
266
257
267
if err != nil {
258
268
return re .report (event , "router error" , err , serviceInternalError )
0 commit comments