You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note how the first error has the ERR_INDEX_OUT_OF_RANGE code while the second one doesn't.
$ node
> var b = new Buffer([])
undefined
> b.writeInt8(3)
RangeError [ERR_INDEX_OUT_OF_RANGE]: Index out of range
at checkInt (buffer.js:1277:11)
at Buffer.writeInt8 (buffer.js:1442:5)
> b.writeDoubleBE(3)
RangeError: Index out of range
at Buffer.writeDoubleBE (buffer.js:1533:5)
>
The affected methods are the write float/double LE/BE functions. All others behave correctly.
This complicates error handling unnecessarily and I don't think this is intended behavior. Bug?
The text was updated successfully, but these errors were encountered:
The floating-point write methods are implemented in C++ and no C++ code currently throws ERR_ codes.
I'm planning to reimplement them in JS. I did that for their read counterparts in #17775 to good effect and it also fixes the error code thing in one swoop.
Note how the first error has the
ERR_INDEX_OUT_OF_RANGE
code while the second one doesn't.The affected methods are the write float/double LE/BE functions. All others behave correctly.
This complicates error handling unnecessarily and I don't think this is intended behavior. Bug?
The text was updated successfully, but these errors were encountered: