ProtoDef-io / node-protodef

Describe your protocol, and read it with ease.
MIT License
31 stars 18 forks source link

Add validate input option #128

Open rom1504 opened 3 years ago

rom1504 commented 3 years ago

Can be implemented by having a validate function for each datatype

useful to debug calls to write

should be optional to avoid perf issues

examples:

Saiv46 commented 3 years ago

i8 : check whether input is between -128 and 127

Btw, all numeric types (except u64) already do validate input.

Maybe add PROTODEF_DEBUG environment variable for interpreter?

loveGhb commented 2 years ago

Hi, how can I fix this for myself? What should be checked and where?

RangeError [ERR_OUT_OF_RANGE]: Write error for undefined : The value of "value" is out of range. It must be >= -128 and <= 127. Received 129