couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r765479 - in /couchdb/trunk: share/server/main.js src/couchdb/couch_js.c src/couchdb/couch_os_process.erl
Date Thu, 16 Apr 2009 06:02:13 GMT
Author: jchris
Date: Thu Apr 16 06:02:12 2009
New Revision: 765479

URL: http://svn.apache.org/viewvc?rev=765479&view=rev
Log:
Baby steps toward better reporting of os_process errors (and JavaScript syntax errors)

Modified:
    couchdb/trunk/share/server/main.js
    couchdb/trunk/src/couchdb/couch_js.c
    couchdb/trunk/src/couchdb/couch_os_process.erl

Modified: couchdb/trunk/share/server/main.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/main.js?rev=765479&r1=765478&r2=765479&view=diff
==============================================================================
--- couchdb/trunk/share/server/main.js [utf-8] (original)
+++ couchdb/trunk/share/server/main.js [utf-8] Thu Apr 16 06:02:12 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/trunk/src/couchdb/couch_js.c
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_js.c?rev=765479&r1=765478&r2=765479&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_js.c (original)
+++ couchdb/trunk/src/couchdb/couch_js.c Thu Apr 16 06:02:12 2009
@@ -231,6 +231,7 @@
     } else {
         ok = JS_EvaluateUCScript(sub_context, sandbox, src, srclen, NULL, -1,
                                  rval);
+        ok = JS_TRUE;
     }
 
 out:

Modified: couchdb/trunk/src/couchdb/couch_os_process.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_os_process.erl?rev=765479&r1=765478&r2=765479&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_os_process.erl (original)
+++ couchdb/trunk/src/couchdb/couch_os_process.erl Thu Apr 16 06:02:12 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,



Mime
View raw message