From bbc0b707e8e2c3a72a85a6fcae54c8b45466b432 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sun, 19 Jan 2020 23:33:22 +0100 Subject: [PATCH] updated error handling --- functions.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions.go b/functions.go index f04a257..cd1557f 100644 --- a/functions.go +++ b/functions.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "strings" + "log" "github.com/labstack/echo/v4" "github.com/likexian/whois-go" @@ -23,12 +24,12 @@ func GetIPInfo(c echo.Context) (ip IP, err error) { err = ip.CheckIPAddress() if err != nil { - return IP{}, err + log.Println(fmt.Sprintf("Error checking IP address %s",ip.IP)) } err = ip.GetHostname() if err != nil { - return IP{}, err + log.Println(fmt.Sprintf("Error checking revers DNS for IP address %s",ip.IP)) } return @@ -39,6 +40,7 @@ func Dip(c echo.Context) (err error) { var ip IP ip, err = GetIPInfo(c) + fmt.Println(err) if err != nil { return c.Render(http.StatusInternalServerError, "error.html", nil) }