diff options
author | Tad Marshall <tad@10gen.com> | 2012-05-31 07:05:35 -0400 |
---|---|---|
committer | Tad Marshall <tad@10gen.com> | 2012-05-31 09:14:40 -0400 |
commit | d0e8e4f665c69e2ee384c0828457038d40b1498e (patch) | |
tree | 65b11109c78bf9130484c8814bd697e41a5a6bcf /src/mongo/scripting/engine_spidermonkey.cpp | |
parent | 135bbe4cc95023348feb05e3bbc59892b9edf23d (diff) | |
download | mongo-d0e8e4f665c69e2ee384c0828457038d40b1498e.tar.gz |
SERVER-5842 don't assert on call inside native_helper
The native_helper() routine in engine_spidermonkey.cpp calls
functions that use Boost, and Boost will throw std:exceptions
on cases such as file and directory protection errors, badly
formed filenames, and others, so we can't call fassertFailed
on these exceptions; they are user errors and need to be passed
back to the JavaScript caller.
Diffstat (limited to 'src/mongo/scripting/engine_spidermonkey.cpp')
-rw-r--r-- | src/mongo/scripting/engine_spidermonkey.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/scripting/engine_spidermonkey.cpp b/src/mongo/scripting/engine_spidermonkey.cpp index cbc4e9aa87c..7bef1b0a5e1 100644 --- a/src/mongo/scripting/engine_spidermonkey.cpp +++ b/src/mongo/scripting/engine_spidermonkey.cpp @@ -1195,7 +1195,17 @@ namespace mongo { a = args.obj(); } - BSONObj out = func( a, data ); + BSONObj out; + try { + out = func( a, data ); + } + catch ( std::exception& e ) { + if ( ! JS_IsExceptionPending( cx ) ) { + JS_ReportError( cx, e.what() ); + } + return JS_FALSE; + } + if ( out.isEmpty() ) { *rval = JSVAL_VOID; } |