Skip to content

Commit 5f7e418

Browse files
api: rework NonInitialized error message
Rework `NonInitialized` error message to be more helpful for troubleshooting. Follows #229, closes #326
1 parent f1b6a12 commit 5f7e418

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
* Rework `NonInitialized` error message to be more helpful for
12+
troubleshooting (#326).
13+
814
## [0.14.0] - 13-09-22
915

1016
### Added

crud/common/utils.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,10 @@ function utils.update_storage_call_error_description(err, func_name, replicaset_
707707
if err.type == 'ClientError' and type(err.message) == 'string' then
708708
if err.message == string.format("Procedure '%s' is not defined", func_name) then
709709
if func_name:startswith('_crud.') then
710-
err = NotInitializedError:new("crud isn't initialized on replicaset: %q",
711-
replicaset_uuid or "Unknown")
710+
err = NotInitializedError:new("Function %s is not registered: " ..
711+
"crud isn't initialized on replicaset %q or crud module versions mismatch " ..
712+
"between router and storage",
713+
func_name, replicaset_uuid or "Unknown")
712714
else
713715
err = NotInitializedError:new("Function %s is not registered", func_name)
714716
end

test/integration/select_test.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,9 @@ pgroup.test_storage_uninit_select_error_text = function(g)
19871987
t.assert_equals(obj, nil)
19881988
t.assert_str_contains(err.str, 'SelectError')
19891989
t.assert_str_contains(err.str, 'NotInitialized')
1990+
t.assert_str_contains(err.str, "Function _crud.select_on_storage is not registered")
19901991
t.assert_str_contains(err.str, "crud isn't initialized on replicaset")
1992+
t.assert_str_contains(err.str, "or crud module versions mismatch between router and storage")
19911993
end
19921994

19931995
pgroup.before_test('test_storage_uninit_get_error_text', function(g)
@@ -2015,5 +2017,7 @@ pgroup.test_storage_uninit_get_error_text = function(g)
20152017
t.assert_equals(obj, nil)
20162018
t.assert_str_contains(err.str, 'GetError')
20172019
t.assert_str_contains(err.str, 'NotInitialized')
2020+
t.assert_str_contains(err.str, "Function _crud.get_on_storage is not registered")
20182021
t.assert_str_contains(err.str, "crud isn't initialized on replicaset")
2022+
t.assert_str_contains(err.str, "or crud module versions mismatch between router and storage")
20192023
end

0 commit comments

Comments
 (0)