diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-22 14:32:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 10:39:04 +0100 |
commit | 25fbdfc66fa995bfe633b3c31d635045f7cf66dd (patch) | |
tree | 3264a851680476ebb7f161d5a38dcff3182a0e8a /src/qml/jsruntime/qv4value.cpp | |
parent | ffcdbfa03f8bb36b521f8c1a703ee24085fe25bd (diff) |
Fix the remaining try/catch statements in C++
Change-Id: I2421dc48fb271b66bd476fb16a32a88fcc4c5177
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4value.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index ebd1894016..a7413e031c 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -125,22 +125,20 @@ QString Value::toQStringNoThrow() const Scope scope(ctx); ScopedValue ex(scope); bool caughtException = false; - try { - ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); - if (prim->isPrimitive()) - return prim->toQStringNoThrow(); - } catch (...) { + ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); + if (scope.hasException()) { ex = ctx->catchException(); caughtException = true; + } else if (prim->isPrimitive()) { + return prim->toQStringNoThrow(); } // Can't nest try/catch due to CXX ABI limitations for foreign exception nesting. if (caughtException) { - try { - ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT)); - if (prim->isPrimitive()) - return prim->toQStringNoThrow(); - } catch(...) { - ctx->catchException(); + ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT)); + if (scope.hasException()) { + ex = ctx->catchException(); + } else if (prim->isPrimitive()) { + return prim->toQStringNoThrow(); } } return QString(); |