Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: fpdfsdk/src/javascript/JS_Context.cpp

Issue 472563002: Remove try/catch block (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tabify Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_Context.cpp
diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp
index e34ffb51baa82db2c82841d7215a79ff36dc12fe..a83e1e057d5fd0e33dc8451fffddb5e6d07f7449 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());
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698