The bitcask backend wraps the key transformation function KT() in a try/catch each time it is called:
K = try KT(K0) catch TxErr -> {key_tx_error, TxErr} end,
However, the TxErr will only match explicitly thrown exceptions. In the case of riak_kv_bitcask_backend:key_transform_to_1/1, if an invalid key is encountered the exception thrown is:
Proper fix is to rework every instances where a key transform is called to use the Class:Exception pattern so exceptions are actually caught.
As an interim workaround, adding a catch-all clause to the transform functions that explicitly throws an exception would allow the existing catch pattern to match for many cases:
The bitcask backend wraps the key transformation function
KT()
in a try/catch each time it is called:K = try KT(K0) catch TxErr -> {key_tx_error, TxErr} end,
However, the
TxErr
will only match explicitly thrown exceptions. In the case of riak_kv_bitcask_backend:key_transform_to_1/1, if an invalid key is encountered the exception thrown is:{error,function_clause,[{riak_kv_bitcask_backend,key_transform_to_1,[<<>>],[{file,"src/riak_kv_bitcask_backend.erl"},{line,99}]}
which is not caught by the above pattern.
Proper fix is to rework every instances where a key transform is called to use the
Class:Exception
pattern so exceptions are actually caught.As an interim workaround, adding a catch-all clause to the transform functions that explicitly throws an exception would allow the existing catch pattern to match for many cases: