You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2025/06/27 17:15:46 UTC
(couchdb) 01/05: fixup! Support more key types in csrt_entry:key/1
This is an automated email from the ASF dual-hosted git repository.
iilyak pushed a commit to branch couch-stats-resource-tracker-v3-rebase-http-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 3d79d1684388532fd44872b36994590236ec1e1f
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Fri Jun 27 09:17:06 2025 -0700
fixup! Support more key types in csrt_entry:key/1
---
src/couch_stats/src/csrt_entry.erl | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/couch_stats/src/csrt_entry.erl b/src/couch_stats/src/csrt_entry.erl
index 0c13ac1d9..094e46ca7 100644
--- a/src/couch_stats/src/csrt_entry.erl
+++ b/src/couch_stats/src/csrt_entry.erl
@@ -60,7 +60,12 @@ key(Key) when is_atom(Key) ->
key(Key) when is_binary(Key) ->
key_from_binary(Key);
key(Key) when is_list(Key) ->
- key_from_binary(list_to_binary(Key));
+ case key_from_binary(list_to_binary(Key)) of
+ {error, {invalid_key, _Key}} ->
+ {error, {invalid_key, Key}};
+ Res ->
+ Res
+ end;
key(Other) ->
key_error(Other).
@@ -97,8 +102,7 @@ key_from_binary(<<"get_kp_node">>) -> get_kp_node;
key_from_binary(Other) -> key_error(Other).
key_error(Key) ->
- Other = iolist_to_binary(io_lib:format("~s", Key)),
- throw({bad_request, <<"Invalid key '", Other/binary, "'">>}).
+ {error, {invalid_key, Key}}.
-spec from_map(Map :: map()) -> rctx().