c-blosc icon indicating copy to clipboard operation
c-blosc copied to clipboard

Signal errors with return codes?

Open ryan-williams opened this issue 7 years ago • 3 comments

While decompressing via JBlosc, I was hitting a -1 return value from because my "dest" buffer wasn't big enough.

I'm responding to all -1s by exponentially increasing my buffer size until I hit 2GB-1, at which point I assume continued failure means the data is corrupt, but it would be nice to differentiate these cases via the return value.

ryan-williams avatar Sep 11 '18 18:09 ryan-williams

Yes, I'm +1 on this, although the error codes would need a more complete overhauling in general. Help in this area is welcome.

FrancescAlted avatar Sep 12 '18 12:09 FrancescAlted

Cool, I was kind of imagining that this would be considered a "breaking change" and not really feasible, but I if there were explicitly no guarantees about return codes previously, other than e.g. "negative means error", then it's not a big deal?

Would the process basically be to replace every return -1 with a unique integer, and document it?

ryan-williams avatar Sep 12 '18 13:09 ryan-williams

Yeah, there are currently no guarantees with that, and yes, a return -integer and documenting it would essentially be it. Thanks for tackling this.

FrancescAlted avatar Sep 12 '18 14:09 FrancescAlted