The main fix here is that cuttlefish_duration:parse/1,2 will now
properly return {error, Reason} instead of just error when an
invalid duration is parsed. Previously, this caused error to be
emitted in the generated config files as seen in basho/riak_kv#809.
Also, in some cases badarith exceptions might be raised when calling
parse/2 because it assumed the parse result was correct and not an
error.
This adds another neotoma parser to the project because the original
code was too difficult to understand and verify, IMO. The new parser
returns a number when it successfully consumes the entire input, any
other result (incomplete parse, parse failure) is treated as an
erroneous duration value.
There are two tests that verify the fix for basho/riak_kv#809, one
uses a schema fixture in cuttlefish_integration_test, the other adds
another case to the extended types test in cuttlefish_generator.
The main fix here is that
cuttlefish_duration:parse/1,2
will now properly return{error, Reason}
instead of justerror
when an invalid duration is parsed. Previously, this causederror
to be emitted in the generated config files as seen in basho/riak_kv#809.Also, in some cases
badarith
exceptions might be raised when callingparse/2
because it assumed the parse result was correct and not an error.This adds another neotoma parser to the project because the original code was too difficult to understand and verify, IMO. The new parser returns a number when it successfully consumes the entire input, any other result (incomplete parse, parse failure) is treated as an erroneous duration value.
There are two tests that verify the fix for basho/riak_kv#809, one uses a schema fixture in
cuttlefish_integration_test
, the other adds another case to the extended types test incuttlefish_generator
.