Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit c5b413d

Browse files
authored
fix exposing detailed AWS SDK error by event API. Closes #344 (#350)
1 parent 0ac2643 commit c5b413d

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

router/errors.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

router/router.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,15 @@ func (router *Router) handleHTTPEvent(event *eventpkg.Event, w http.ResponseWrit
265265
event.Data = httpdata
266266
resp, err := router.callFunction(*backingFunction, *event)
267267
if err != nil {
268-
http.Error(w, err.Error(), http.StatusInternalServerError)
268+
http.Error(w, "function call failed", http.StatusInternalServerError)
269269
return
270270
}
271271

272272
httpResponse := &HTTPResponse{StatusCode: http.StatusOK}
273273
err = json.Unmarshal(resp, httpResponse)
274274
if err != nil {
275-
httperr := NewErrHTTPResponseObjectMalformed()
276-
http.Error(w, httperr.Error(), httperr.StatusCode)
277-
278-
router.log.Info(httperr.Error(), zap.String("response", string(resp)))
279-
275+
router.log.Info("HTTP response object malformed.", zap.String("response", string(resp)))
276+
http.Error(w, "HTTP response object malformed", http.StatusInternalServerError)
280277
return
281278
}
282279

0 commit comments

Comments
 (0)