msgpack-lite icon indicating copy to clipboard operation
msgpack-lite copied to clipboard

better error message - BUFFER_SHORTAGE

Open jvsteiner opened this issue 5 years ago • 2 comments

I recently ran into "BUFFER_SHORTAGE" errors due to what ended up being an encoding problem on my end. My suggestion is that "BUFFER_SHORTAGE" is perhaps not a correctly descriptive error message. I would recommend something like "BUFFER_TOO_SHORT" instead, since "BUFFER_SHORTAGE" make it sound like something is having trouble allocating a buffer, due to memory constraints, or something. You don't have a shortage of buffers in this case - you have a buffer that is too short.

Originally posted by @jvsteiner in https://github.com/kawanet/msgpack-lite/issues/60#issuecomment-703238575

jvsteiner avatar Oct 04 '20 11:10 jvsteiner

I'm having the same error, not knowing what I did wrong. Can you provide some information on what "encoding problem" you encountered?

c0per avatar Dec 05 '21 14:12 c0per

It's been a while, but iirc, I was encoding the object somewhere, and that wasn't working right, resulting in a zero length buffer, which caused the error when I tried to decode it.

jvsteiner avatar Dec 05 '21 15:12 jvsteiner