From 3e47bfd6586f42f9fe8e49cea03c4df976c781a1 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 18 Apr 2009 20:15:44 +0000 Subject: refactor main.js into many files and improve show/list error handling git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766383 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_view.erl | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src/couchdb/couch_httpd_view.erl') diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl index 0348cf8b..8702a3dc 100644 --- a/src/couchdb/couch_httpd_view.erl +++ b/src/couchdb/couch_httpd_view.erl @@ -530,7 +530,7 @@ apply_default_helper_funs(#view_fold_helper_funs{ Helpers#view_fold_helper_funs{ passed_end = PassedEnd2, start_response = StartResp2, - send_row = wrap_for_chunked_errors(SendRow2) + send_row = SendRow2 }. apply_default_helper_funs(#reduce_fold_helper_funs{ @@ -549,7 +549,7 @@ apply_default_helper_funs(#reduce_fold_helper_funs{ Helpers#reduce_fold_helper_funs{ start_response = StartResp2, - send_row = wrap_for_chunked_errors(SendRow2) + send_row = SendRow2 }. make_passed_end_fun(fwd, EndKey, EndDocId, InclusiveEnd) -> @@ -606,27 +606,7 @@ send_json_reduce_row(Resp, {Key, Value}, RowFront) -> nil -> ",\r\n"; _ -> RowFront end, - send_chunk(Resp, RowFront2 ++ ?JSON_ENCODE({[{key, Key}, {value, Value}]})). - -wrap_for_chunked_errors(Fun) when is_function(Fun, 3)-> - fun(Resp, B, C) -> - try Fun(Resp, B, C) - catch - throw:Error -> - send_chunked_error(Resp, Error), - throw({already_sent, Error}) - end - end; - -wrap_for_chunked_errors(Fun) when is_function(Fun, 5)-> - fun(Resp, B, C, D, E) -> - try Fun(Resp, B, C, D, E) - catch - throw:Error -> - send_chunked_error(Resp, Error), - throw({already_sent, Error}) - end - end. + send_chunk(Resp, RowFront2 ++ ?JSON_ENCODE({[{key, Key}, {value, Value}]})). view_group_etag(Group) -> view_group_etag(Group, nil). -- cgit v1.2.3