summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db.erl4
-rw-r--r--src/index.erl11
2 files changed, 7 insertions, 8 deletions
diff --git a/src/db.erl b/src/db.erl
index 85ed5d8..bf17e96 100644
--- a/src/db.erl
+++ b/src/db.erl
@@ -235,8 +235,8 @@ handle_call(stop, _From, State) ->
{stop, normal, stopped, State};
handle_call({add_index_nosync_noreverse, {LeafHash, Index}}, _From, State) ->
- ok = index:add_nosync(index_db, Index, LeafHash),
- {reply, ok, State}.
+ Result = index:add_nosync(index_db, Index, LeafHash),
+ {reply, Result, State}.
indexforhash_nosync(LeafHash, Index) ->
ok = perm:addvalue(indexforhash_db,
diff --git a/src/index.erl b/src/index.erl
index fe47f59..5fe1dd6 100644
--- a/src/index.erl
+++ b/src/index.erl
@@ -95,8 +95,7 @@ add_internal(File, Index, Entry) when is_binary(Entry), size(Entry) == ?ENTRYSIZ
Index * ?ENTRYSIZEINFILE < Position ->
read;
_ ->
- util:exit_with_error(invalid, writefile,
- "Index not valid")
+ {error, invalidindex}
end,
EntryText = hex:bin_to_hexstr(Entry) ++ "\n",
case Mode of
@@ -112,10 +111,10 @@ add_internal(File, Index, Entry) when is_binary(Entry), size(Entry) == ?ENTRYSIZ
EntryText ->
ok;
_ ->
- util:exit_with_error(invalid, writefile,
- "Written content not the" ++
- " same as old content")
- end
+ {error, invalidcontent}
+ end;
+ {error, Error} ->
+ {error, Error}
end.