Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep error info #21

Merged
merged 2 commits into from
Jun 6, 2017
Merged

Keep error info #21

merged 2 commits into from
Jun 6, 2017

Commits on Feb 23, 2017

  1. Keep information on errors while reporting them

    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}]}]}}}}}
    ```
    Luca Favatella committed Feb 23, 2017
    Configuration menu
    Copy the full SHA
    d030946 View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2017

  1. Merge branch 'master' into keep-error-info

    Brujo Benavides authored Jun 6, 2017
    Configuration menu
    Copy the full SHA
    e81bfd6 View commit details
    Browse the repository at this point in the history