mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 00:47:09 +00:00
chore(control): more detailed server error logs
This commit is contained in:
@@ -105,14 +105,17 @@ func wakeOnLanRoute(ctx echo.Context) error {
|
|||||||
}
|
}
|
||||||
mac, err := net.ParseMAC(data.MACAddress)
|
mac, err := net.ParseMAC(data.MACAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
slog.Warn("Invalid MAC address provided", "mac_address", data.MACAddress, "error", err)
|
||||||
return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: "Invalid MAC address"})
|
return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: "Invalid MAC address"})
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := wol.NewClient()
|
client, err := wol.NewClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
slog.Error("Failed to create Wake-on-LAN client", "error", err)
|
||||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to create Wake-on-LAN client"})
|
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to create Wake-on-LAN client"})
|
||||||
}
|
}
|
||||||
if err := client.Wake("255.255.255.255:7", mac); err != nil {
|
if err := client.Wake("255.255.255.255:7", mac); err != nil {
|
||||||
|
slog.Error("Failed to send Wake-on-LAN packet", "error", err)
|
||||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to send Wake-on-LAN packet"})
|
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to send Wake-on-LAN packet"})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user