Skip to content

Commit

Permalink
Merge pull request #416 from carlzogh/main
Browse files Browse the repository at this point in the history
Log function error on failure
  • Loading branch information
aboelhamd authored Dec 10, 2021
2 parents 14da40f + 76660fc commit 0462b00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lambda/invoke_loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"strconv"
"time"

Expand Down Expand Up @@ -47,8 +48,9 @@ func handleInvoke(invoke *invoke, function *Function) error {
}

if functionResponse.Error != nil {
payload := safeMarshal(functionResponse.Error)
if err := invoke.failure(payload, contentTypeJSON); err != nil {
errorPayload := safeMarshal(functionResponse.Error)
log.Printf("%s", errorPayload)
if err := invoke.failure(errorPayload, contentTypeJSON); err != nil {
return fmt.Errorf("unexpected error occurred when sending the function error to the API: %v", err)
}
if functionResponse.Error.ShouldExit {
Expand Down

0 comments on commit 0462b00

Please sign in to comment.