From 19dcda6fdecf0606fe82aa2bb0cd26a4d1eb9264 Mon Sep 17 00:00:00 2001
From: bingyanglin <bingyang.lin@iota.org>
Date: Thu, 18 Jul 2019 18:29:12 +0800
Subject: [PATCH] update_error_check

---
 plugins/metrics/server.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/plugins/metrics/server.go b/plugins/metrics/server.go
index 1cccf6d2..55bce93a 100644
--- a/plugins/metrics/server.go
+++ b/plugins/metrics/server.go
@@ -11,11 +11,11 @@ import (
 )
 
 var (
-	_, filename, _, _ = runtime.Caller(0)
-	Clients           = make(map[*websocket.Conn]bool)
-	templPath         = filepath.Join(filepath.Dir(filename), "./dashboard.html")
-	homeTempl, _      = template.ParseFiles(templPath)
-	upgrader          = websocket.Upgrader{
+	_, filename, _, runtime_ok = runtime.Caller(0)
+	Clients                    = make(map[*websocket.Conn]bool)
+	templPath                  = filepath.Join(filepath.Dir(filename), "./dashboard.html")
+	homeTempl, _               = template.ParseFiles(templPath)
+	upgrader                   = websocket.Upgrader{
 		ReadBufferSize:  1024,
 		WriteBufferSize: 1024,
 	}
@@ -44,6 +44,9 @@ func ServeHome(w http.ResponseWriter, r *http.Request) {
 		http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
 		return
 	}
+	if !runtime_ok {
+		panic("Server runtime caller error")
+	}
 
 	var v = struct {
 		Host string
-- 
GitLab