From 870a811ca2c87b0fe885da3804c13310f32d155d Mon Sep 17 00:00:00 2001 From: Kayla Nguyen Date: Mon, 8 May 2023 18:45:03 -0500 Subject: [PATCH] fix: wrap panic message when log to stderr --- funcframework/framework.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funcframework/framework.go b/funcframework/framework.go index d660f08..f6963ac 100644 --- a/funcframework/framework.go +++ b/funcframework/framework.go @@ -49,7 +49,7 @@ var errorType = reflect.TypeOf((*error)(nil)).Elem() func recoverPanic(w http.ResponseWriter, panicSrc string) { if r := recover(); r != nil { genericMsg := fmt.Sprintf(panicMessageTmpl, panicSrc) - fmt.Fprintf(os.Stderr, "%s\npanic message: %v\nstack trace: \n%s", genericMsg, r, debug.Stack()) + fmt.Fprintf(os.Stderr, fmt.Sprintf("%s\npanic message: %v\nstack trace: \n%s", genericMsg, r, debug.Stack())) if w != nil { writeHTTPErrorResponse(w, http.StatusInternalServerError, crashStatus, genericMsg) }