diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-04 10:50:25 -0800 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-12-04 20:08:43 +0100 |
commit | 944af86fca2eac90cd6528d2dfbff5316fa911a9 (patch) | |
tree | a531a734ac50dc22b933d739da856d7e6b56fa7b /qmljs_environment.cpp | |
parent | 955f5f03afd9915b7f43ff07ce4b624a86c58a1a (diff) |
Throw proper type and reference errors
Change-Id: I898017f3e63ada72fc2e50abfa1880f9fd7ffe37
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_environment.cpp')
-rw-r--r-- | qmljs_environment.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/qmljs_environment.cpp b/qmljs_environment.cpp index 94a877586a..12a2091dc8 100644 --- a/qmljs_environment.cpp +++ b/qmljs_environment.cpp @@ -284,8 +284,7 @@ void ExecutionContext::throwSyntaxError(DiagnosticMessage *message) void ExecutionContext::throwTypeError() { - Value v = Value::fromString(this, QStringLiteral("Type error")); - throwError(Value::fromObject(engine->newErrorObject(v))); + throwError(Value::fromObject(engine->newTypeErrorObject(this, QStringLiteral("Type error")))); } void ExecutionContext::throwUnimplemented(const QString &message) @@ -298,7 +297,7 @@ void ExecutionContext::throwReferenceError(Value value) { String *s = value.toString(this); QString msg = s->toQString() + QStringLiteral(" is not defined"); - throwError(Value::fromObject(engine->newErrorObject(Value::fromString(this, msg)))); + throwError(Value::fromObject(engine->newReferenceErrorObject(this, msg))); } void ExecutionContext::initCallContext(ExecutionContext *parent, const Value that, FunctionObject *f, Value *args, unsigned argc) |