Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix error reason

  • Loading branch information...
commit e1514f4144ef97601ba16bec2f7f31e4da9cff87 1 parent 3672ea5
Ryosuke Nakai authored
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/eini.erl
  2. +2 −2 test/eini_tests.erl
View
4 src/eini.erl
@@ -163,7 +163,7 @@ handle_call({register, Filename, Section, Name, Value}, _From, State) ->
true ->
{reply, ok, State};
false ->
- {reply, {error, duplicate_key}, State}
+ {reply, {error, {duplicate_key, Section, Name}}, State}
end;
handle_call({register, Filename, Binary}, _From, State) ->
case eini:parse(Binary) of
@@ -216,5 +216,5 @@ insert_section(Filename, ListOfSection, Section, [{Name, Value}|ListOfParameter]
true ->
insert_section(Filename, ListOfSection, Section, ListOfParameter);
false ->
- {error, duplicate_key}
+ {error, {duplicate_key, Section, Name}}
end.
View
4 test/eini_tests.erl
@@ -534,9 +534,9 @@ register_test_() ->
eini:register("spam.ini", title, key1, <<"value">>)),
?assertEqual(<<"value">>,
eini:lookup_value("spam.ini", title, key1)),
- ?assertEqual({error, duplicate_key},
+ ?assertEqual({error, {duplicate_key, title, key1}},
eini:register("spam.ini", title, key1, <<"value">>)),
- ?assertEqual({error, duplicate_key},
+ ?assertEqual({error, {duplicate_key, title, key}},
eini:register("spam.ini", "[title]\nkey=value"))
end}
]
Please sign in to comment.
Something went wrong with that request. Please try again.