1. Report wrong datatype of the bucket if key not found rather then
considering the error as plain "key not found" error.
* This also improves readibility by:
* Clarifying what the value discarded before error reporting is;
* Hardcoding the expectation of the module of map data type.
* See also:
* https://github.com/basho/riak-erlang-client/blob/2.5.2/src/riakc_pb_socket.erl#L1262-L1264
* https://github.com/basho/riak-erlang-client/blob/2.5.2/src/riakc_datatype.erl#L94
2. Tag errors while streaming keys as such, because caller may not
expect key streaming error while having requested apparently
completely separate operation.
3. Keep whether streaming error is timeout or other error;
4. Hardcode expectation of no continuation in key stream, because no
max number of results specificied when requesting key stream in the
first place.
* Refs:
* https://github.com/basho/riak-erlang-client/blob/2.5.2/src/riakc_pb_socket.erl#L1019-L1023
* https://github.com/basho/riak-erlang-client/blob/2.5.2/src/riakc_pb_socket.erl#L1806-L1814
* https://github.com/basho/riak-erlang-client/blob/2.5.2/include/riakc.hrl#L151-L156
* https://github.com/basho/riak_test/blob/743d5dfb20717a81bb79392522c0581309205d76/tests/secondary_index_tests.erl#L204-L235
5. Prefer `exit` over `throw` in order to keep stacktrace.
* See also inaka/erlang_guidelines#71
6. Keep most information on errors while persisting.
* Function for persisting has room for improvements - out of scope
for this commit though.
Also perform minor clarification of variable name in stream reception.
----
These changes are beneficial when attempting to determing why
something does not work. E.g. if a user attempt to get started on
sumo_db_riak with a Riak configured with bitcask backend rather than
leveldb then these changes make the error be like the following (this
is an excerpt from a test suite run - note strings `stream_keys`,
`indexes_not_supported,riak_kv_bitcask_backend`):
```
%%% basic_SUITE ==> find: SKIPPED
%%% basic_SUITE ==> {tc_auto_skip,
{auto_skipped,
{failed,
{basic_SUITE,init_per_testcase,
{{error,
{stream_keys,
{unexpected,
{82448287,
{error,
<<"{error,{indexes_not_supported,riak_kv_bitcask_backend}}">>}}},
0}},
[{sumo,delete_all,1,
[{file,
"/Users/luca/dev/vuk/inaka_crud/sumo_db_riak/_build/default/lib/sumo_db/src/sumo.erl"},
{line,227}]},
{sumo_basic_test_helper,init_store,1,
[{file,
"/Users/luca/dev/vuk/inaka_crud/sumo_db_riak/_build/default/lib/sumo_db/src/adapter_test_helpers/sumo_basic_test_helper.erl"},
{line,165}]},
{basic_SUITE,init_per_testcase,2,
[{file,
"/Users/luca/dev/vuk/inaka_crud/sumo_db_riak/_build/test/lib/sumo_db_riak/test/basic_SUITE.erl"},
{line,51}]},
{test_server,do_init_per_testcase,2,
[{file,"test_server.erl"},{line,1297}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1007}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,977}]}]}}}}}
```