diff --git a/src/ts_api.erl b/src/ts_api.erl index b7cc81d..f54027b 100644 --- a/src/ts_api.erl +++ b/src/ts_api.erl @@ -487,6 +487,8 @@ delete_entry(YArg, Username, TimelineId, EntryId) -> % find the record to delete case ts_entry:lookup(Username, TimelineId, EntryId) of + no_record -> make_json_404(YArg); + Record -> % try to delete case ts_entry:delete(Record) of @@ -494,9 +496,7 @@ delete_entry(YArg, Username, TimelineId, EntryId) -> Error -> io:format("Error occurred deleting entry record: ~p", [Error]), make_json_500(YArg) - end; - - no_record -> make_json_404(YArg) + end end. % ============================== %