add more logs

This commit is contained in:
Erikas 2024-07-05 00:30:52 +03:00
parent 5a9d44c8ff
commit 037f1f4132

View File

@ -6,6 +6,7 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"io" "io"
"log"
"net/http" "net/http"
"github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions"
@ -47,6 +48,7 @@ func getLoginCallback(c *gin.Context) {
token, err := discordConf.Exchange(context.Background(), c.Query("code")) token, err := discordConf.Exchange(context.Background(), c.Query("code"))
if err != nil { if err != nil {
log.Println(err)
c.HTML(http.StatusInternalServerError, "error_raw.tmpl", gin.H{ c.HTML(http.StatusInternalServerError, "error_raw.tmpl", gin.H{
"errorMessage": "Failed to exchange code for token", "errorMessage": "Failed to exchange code for token",
}) })
@ -55,6 +57,7 @@ func getLoginCallback(c *gin.Context) {
res, err := discordConf.Client(context.Background(), token).Get("https://discord.com/api/users/@me") res, err := discordConf.Client(context.Background(), token).Get("https://discord.com/api/users/@me")
if err != nil { if err != nil {
log.Println(err)
c.HTML(http.StatusInternalServerError, "error_raw.tmpl", gin.H{ c.HTML(http.StatusInternalServerError, "error_raw.tmpl", gin.H{
"errorMessage": "Failed to get user details from Discord", "errorMessage": "Failed to get user details from Discord",
}) })