From aef9dbd3a6cbb85085023d3c8565740e09fd6a77 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Sat, 21 Nov 2009 13:43:43 +0000 Subject: code improvements from tidier. Patch by Kostis Sagonas. COUCHDB-570 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@882903 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_show.erl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/couchdb/couch_httpd_show.erl') diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl index 4ed11c2a..14b9b415 100644 --- a/src/couchdb/couch_httpd_show.erl +++ b/src/couchdb/couch_httpd_show.erl @@ -50,11 +50,10 @@ handle_doc_update_req(#httpd{ #doc{body={Props}} = couch_httpd_db:couch_doc_open(Db, DesignId, nil, []), Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>), UpdateSrc = couch_util:get_nested_json_value({Props}, [<<"updates">>, UpdateName]), - Doc = try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) of - FoundDoc -> FoundDoc - catch - _ -> nil - end, + Doc = try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) + catch + _ -> nil + end, send_doc_update_response(Lang, UpdateSrc, DocId, Doc, Req, Db); handle_doc_update_req(#httpd{ @@ -66,13 +65,11 @@ handle_doc_update_req(#httpd{ UpdateSrc = couch_util:get_nested_json_value({Props}, [<<"updates">>, UpdateName]), send_doc_update_response(Lang, UpdateSrc, nil, nil, Req, Db); - handle_doc_update_req(Req, _Db) -> send_error(Req, 404, <<"update_error">>, <<"Invalid path.">>). - handle_doc_show(Req, DesignName, ShowName, DocId, Db) -> DesignId = <<"_design/", DesignName/binary>>, #doc{body={Props}} = couch_httpd_db:couch_doc_open(Db, DesignId, nil, []), @@ -81,8 +78,7 @@ handle_doc_show(Req, DesignName, ShowName, DocId, Db) -> Doc = case DocId of nil -> nil; _ -> - try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) of - FoundDoc -> FoundDoc + try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) catch _ -> nil end -- cgit v1.2.3