From 356c5cb699b2294642c3893c1522f5bcdc1fc500 Mon Sep 17 00:00:00 2001 From: Nuwan Kaman Date: Fri, 30 Sep 2016 01:21:51 +1000 Subject: [PATCH] #79 properly handle the list_to_atom operations --- src/cberl.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cberl.erl b/src/cberl.erl index 1f8cd14..40e4dbe 100644 --- a/src/cberl.erl +++ b/src/cberl.erl @@ -449,5 +449,9 @@ query_arg({startkey, V}) when is_list(V) -> string:join(["startkey", V], "="); query_arg({startkey_docid, V}) when is_list(V) -> string:join(["startkey_docid", V], "="). -view_error(Error) -> list_to_atom(binary_to_list(Error)). - +view_error(Error) -> + ErrorStr = binary_to_list(Error), + case catch list_to_existing_atom(ErrorStr) of + {'EXIT', {badarg, _}} -> list_to_atom(ErrorStr); + TypeAtom -> TypeAtom + end.