diff --git a/internal/decoders/data_packet_chunk.go b/internal/decoders/data_packet_chunk.go index 9e319e8..b516b20 100644 --- a/internal/decoders/data_packet_chunk.go +++ b/internal/decoders/data_packet_chunk.go @@ -2,7 +2,7 @@ package decoders import ( "encoding/binary" - "log/slog" + "fmt" "github.com/jwetzell/psn-go/internal/chunks" ) @@ -43,7 +43,7 @@ func DecodeDataPacketChunk(bytes []byte) (chunks.DataPacketChunk, error) { } default: - slog.Error("unhandled info packet id", "id", id) + return chunks.DataPacketChunk{}, fmt.Errorf("unknown data packet ID: 0x%04x", id) } } } diff --git a/internal/decoders/data_tracker_chunk.go b/internal/decoders/data_tracker_chunk.go index c59c638..e57f606 100644 --- a/internal/decoders/data_tracker_chunk.go +++ b/internal/decoders/data_tracker_chunk.go @@ -2,7 +2,7 @@ package decoders import ( "encoding/binary" - "log/slog" + "fmt" "github.com/jwetzell/psn-go/internal/chunks" ) @@ -93,7 +93,7 @@ func DecodeDataTrackerChunk(bytes []byte) (chunks.DataTrackerChunk, error) { } default: offset = int(chunk.Header.DataLen) - slog.Error("unhandled data tracker packet chunk id", "id", id) + return chunks.DataTrackerChunk{}, fmt.Errorf("unknown data tracker chunk ID: 0x%04x", id) } } } diff --git a/internal/decoders/info_packet_chunk.go b/internal/decoders/info_packet_chunk.go index 26ac06a..3db788c 100644 --- a/internal/decoders/info_packet_chunk.go +++ b/internal/decoders/info_packet_chunk.go @@ -2,7 +2,7 @@ package decoders import ( "encoding/binary" - "log/slog" + "fmt" "github.com/jwetzell/psn-go/internal/chunks" ) @@ -51,7 +51,7 @@ func DecodeInfoPacketChunk(bytes []byte) (chunks.InfoPacketChunk, error) { } default: - slog.Error("unhandled info packet id", "id", id) + return chunks.InfoPacketChunk{}, fmt.Errorf("unknown info packet ID: 0x%04x", id) } } } diff --git a/internal/decoders/info_tracker_chunk.go b/internal/decoders/info_tracker_chunk.go index b7ec965..fde8392 100644 --- a/internal/decoders/info_tracker_chunk.go +++ b/internal/decoders/info_tracker_chunk.go @@ -2,7 +2,7 @@ package decoders import ( "encoding/binary" - "log/slog" + "fmt" "github.com/jwetzell/psn-go/internal/chunks" ) @@ -30,7 +30,7 @@ func DecodeInfoTrackerChunk(bytes []byte) (chunks.InfoTrackerChunk, error) { offset = offset + int(tracker_name.Chunk.Header.DataLen) } default: - slog.Error("unhandled info tracker chunk id", "id", id) + return chunks.InfoTrackerChunk{}, fmt.Errorf("unknown info tracker chunk ID: 0x%04x", id) } } }