updated error handling
This commit is contained in:
parent
898110de47
commit
bbc0b707e8
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user