e528244

Branches > refactor/use-spec-1 > e528244 > files / src / net / bowmap

Update docstring and error message in decode-packet!

Grahp, 2026-02-27

Commit: e528244ba08f51b5f0cf8b7842ae16ef6eb29545
Parent: 524e938

1 changed file:

src/net/bowmap/packets/server.clj modified (view file)

@@ -1,7 +1,7 @@ (ns net.bowmap.packets.server   (:require    [clojure.alpha.spec :as s]-   [dev.grahp.error :refer [assert!]]+   [dev.grahp.error :refer [assert! raise]]    [net.bowmap.client.state :as state]    [net.bowmap.codecs.read :as read]    [net.bowmap.packet :as pk]@@ -80,7 +80,7 @@   (packets (packet-id state numeric-id)))  (defn decode-packet!-  "Decodes and returns one packet from ByteBuf 'buf'.+  "Decodes and returns one packet from ByteBuf 'buf', which should contain at least one readable packet.    The initial length field of the packet should not be stripped from 'buf'.    Can throw if:     1. No such packet with the packet id and state exists@@ -92,5 +92,7 @@   ;; None of those packets have been implemented yet, though.   (let [_unused-length (read/read-varint! buf)         numeric-id (read/read-varint! buf)-        dedec (assert! (packet state numeric-id))]-    (dedec buf)))+        dedec (packet state numeric-id)]+    (if dedec+      (dedec buf)+      (raise "Failed to decode packet, no such packet with that id." {:id numeric-id :state state}))))