From d4e406e254b5a60e58ff2fcc12b59bef7e436e74 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Wed, 13 Aug 2014 11:03:19 -0700 Subject: Remove try/catch block BUG=pdfium:28 R=thakis@chromium.org Review URL: https://codereview.chromium.org/472563002 --- fpdfsdk/src/javascript/JS_Context.cpp | 43 ++++++++++++++--------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'fpdfsdk/src/javascript/JS_Context.cpp') diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index e34ffb51ba..a83e1e057d 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -68,41 +68,32 @@ FX_BOOL CJS_Context::DoJob(int nMode, const CFX_WideString& script, CFX_WideStri FXJSErr error ={NULL,NULL, 0}; int nRet = 0; - try - { - if (script.GetLength() > 0) + if (script.GetLength() > 0) + { + if (nMode == 0) { - if (nMode == 0) - { - nRet = JS_Execute(*m_pRuntime, this, script, script.GetLength(), &error); - } - else - { - nRet = JS_Parse(*m_pRuntime, this, script, script.GetLength(), &error); - } + nRet = JS_Execute(*m_pRuntime, this, script, script.GetLength(), &error); } - - if (nRet < 0) + else { - CFX_WideString sLine; - sLine.Format((FX_LPCWSTR)L"[ Line: %05d { %s } ] : %s",error.linnum-1,error.srcline,error.message); + nRet = JS_Parse(*m_pRuntime, this, script, script.GetLength(), &error); + } + } + + if (nRet < 0) + { + CFX_WideString sLine; + sLine.Format((FX_LPCWSTR)L"[ Line: %05d { %s } ] : %s",error.linnum-1,error.srcline,error.message); // TRACE(L"/* -------------- JS Error -------------- */\n"); // TRACE(sLine); // TRACE(L"\n"); - //CFX_ByteString sTemp = CFX_ByteString::FromUnicode(error.message); - info += sLine; - } - else - { - info = JSGetStringFromID(this, IDS_STRING_RUN); - } - + //CFX_ByteString sTemp = CFX_ByteString::FromUnicode(error.message); + info += sLine; } - catch (...) + else { - info = JSGetStringFromID(this, IDS_STRING_UNHANDLED); - nRet = -1; + info = JSGetStringFromID(this, IDS_STRING_RUN); } m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(), m_pEventHandler->EventType()); -- cgit v1.2.3