streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Throw a specific exception in deserialize failure

Open harendra-kumar opened this issue 2 years ago • 3 comments

Currently we just call error:

        if (next <= sz)
        then Unbox.peekByteIndex off arr >>= \val -> pure (next, val)
        else error
            $ "deserialize: accessing array at offset = "
                ++ show (next - 1)
                ++ " max valid offset = " ++ show (sz - 1)

harendra-kumar avatar Nov 21 '23 18:11 harendra-kumar

When we are deserializing we can throw DeserializeUnderflow and when serializing SerializeOverflow. SerializeOverflow can be useful to re-allocate only if we overflow.

harendra-kumar avatar Jul 19 '24 00:07 harendra-kumar

Should we do the same for Unbox as well?

harendra-kumar avatar Jul 19 '24 20:07 harendra-kumar

Currently, we seldom bound-check. Should we bound check on every deserializeAt and at every serializeAt?

adithyaov avatar Jul 22 '24 20:07 adithyaov