You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2009/04/18 22:42:19 UTC

svn commit: r766388 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/server/main.js src/couchdb/couch_js.c src/couchdb/couch_os_process.erl

Author: jchris
Date: Sat Apr 18 20:42:19 2009
New Revision: 766388

URL: http://svn.apache.org/viewvc?rev=766388&view=rev
Log:
merge 765479 (better JS error handling) into 0.9.x branch

Modified:
    couchdb/branches/0.9.x/   (props changed)
    couchdb/branches/0.9.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.9.x/share/server/main.js
    couchdb/branches/0.9.x/src/couchdb/couch_js.c
    couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl

Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 20:42:19 2009
@@ -1,3 +1,3 @@
 /couchdb/branches/design_resources:751716-751803
 /couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373
+/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373

Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 20:42:19 2009
@@ -1,4 +1,4 @@
 /couchdb/branches/design_resources/etc/default/couchdb:751716-751803
 /couchdb/branches/form/etc/default/couchdb:729440-730015
-/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373
+/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.9.x/share/server/main.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/server/main.js?rev=766388&r1=766387&r2=766388&view=diff
==============================================================================
--- couchdb/branches/0.9.x/share/server/main.js [utf-8] (original)
+++ couchdb/branches/0.9.x/share/server/main.js [utf-8] Sat Apr 18 20:42:19 2009
@@ -414,7 +414,8 @@
   } catch(e) {
     log("function raised error: "+e.toString());
     log("stacktrace: "+e.stack);
-    respond({error:"render_error",reason:e});
+    var errorMessage = "function raised error: "+e.toString()+"\nstacktrace: "+e.stack;
+    respond({error:"render_error",reason:errorMessage});
   }
 };
 

Modified: couchdb/branches/0.9.x/src/couchdb/couch_js.c
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_js.c?rev=766388&r1=766387&r2=766388&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_js.c (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_js.c Sat Apr 18 20:42:19 2009
@@ -231,6 +231,7 @@
     } else {
         ok = JS_EvaluateUCScript(sub_context, sandbox, src, srclen, NULL, -1,
                                  rval);
+        ok = JS_TRUE;
     }
 
 out:

Modified: couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl?rev=766388&r1=766387&r2=766388&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl Sat Apr 18 20:42:19 2009
@@ -51,7 +51,13 @@
     gen_server:call(Pid, read).
 
 prompt(Pid, Data) ->
-    gen_server:call(Pid, {prompt, Data}, infinity).
+    case gen_server:call(Pid, {prompt, Data}, infinity) of
+        {ok, Result} ->
+            Result;
+        {error, Error} ->
+            ?LOG_DEBUG("OS Process Error ~p",[Error]),
+            throw(Error)
+    end.
 
 async(Pid, Data, CallBack) ->
     gen_server:cast(Pid, {async, Data, CallBack}).
@@ -138,7 +144,13 @@
 handle_call({prompt, Data}, _From, OsProc) ->
     #os_proc{writer=Writer, reader=Reader} = OsProc,
     Writer(OsProc, Data),
-    {reply, Reader(OsProc), OsProc}.
+    Result = try Reader(OsProc) of
+        Ok -> {ok, Ok}
+    catch
+        throw:OsError ->
+            {error, OsError}
+    end,
+    {reply, Result, OsProc}.
 
 handle_cast({async, Data, CallBack}, OsProc) ->
     #os_proc{writer=Writer, reader=Reader} = OsProc,