diff options
author | bep <bjorn.erik.pedersen@gmail.com> | 2015-02-18 21:51:32 +0100 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-02-18 21:51:32 +0100 |
commit | 4d708f096d5df64bf7309cbed67564d98c8e815a (patch) | |
tree | 61c7bb12005da2b2643b6bda6abbc6d25e0c5e7d /transform/livereloadinject.go | |
parent | d2e022f2a7c3654cd1aaf24ea9134e61cb913cec (diff) |
Add revocer in LiveReloadInject
The panic cannot be reproduced, but add this as protection.
Fixes #911
Diffstat (limited to 'transform/livereloadinject.go')
-rw-r--r-- | transform/livereloadinject.go | 7 |
1 files changed, 6 insertions, 1 deletions
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("</body>") port := viper.GetString("port") replace := []byte(`<script>document.write('<script src="http://' |