From 4d708f096d5df64bf7309cbed67564d98c8e815a Mon Sep 17 00:00:00 2001 From: bep Date: Wed, 18 Feb 2015 21:51:32 +0100 Subject: [PATCH] Add revocer in LiveReloadInject The panic cannot be reproduced, but add this as protection. Fixes #911 --- transform/livereloadinject.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index 0973841b3..4f572b57c 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -2,11 +2,16 @@ package transform import ( "bytes" - + jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" ) func LiveReloadInject(content []byte) []byte { + defer func() { + if r := recover(); r != nil { + jww.ERROR.Println("Recovered in LiveReloadInject", r) + } + }() match := []byte("") port := viper.GetString("port") replace := []byte(`