Changeset 35245 in webkit for trunk/JavaScriptCore/kjs/Error.cpp


Ignore:
Timestamp:
Jul 18, 2008, 6:44:24 PM (17 years ago)
Author:
[email protected]
Message:

Bug 18774: SQUIRRELFISH: print meaningful error messages <https://bugs.webkit.org/show_bug.cgi?id=18774>
<rdar://problem/5769353> SQUIRRELFISH: JavaScript error messages are missing informative text

Reviewed by Cameron Zwarich

Add support for decent error messages in JavaScript. This patch achieves this by providing
ensuring the common errors and exceptions have messages that provide the text of expression
that trigger the exception. In addition it attaches a number of properties to the exception
object detailing where in the source the expression came from.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/Error.cpp

    r35022 r35245  
    3333
    3434namespace KJS {
     35
     36const char* expressionBeginOffsetPropertyName = "expressionBeginOffset";
     37const char* expressionCaretOffsetPropertyName = "expressionCaretOffset";
     38const char* expressionEndOffsetPropertyName = "expressionEndOffset";
    3539
    3640JSObject* Error::create(ExecState* exec, ErrorType type, const UString& message, int lineNumber, int sourceId, const UString& sourceURL)
     
    7983
    8084    if (lineNumber != -1)
    81         error->put(exec, Identifier(exec, "line"), jsNumber(exec, lineNumber));
     85        error->putWithAttributes(exec, Identifier(exec, "line"), jsNumber(exec, lineNumber), ReadOnly | DontDelete);
    8286    if (sourceId != -1)
    83         error->put(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceId));
     87        error->putWithAttributes(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceId), ReadOnly | DontDelete);
    8488    if (!sourceURL.isNull())
    85         error->put(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL));
     89        error->putWithAttributes(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL), ReadOnly | DontDelete);
    8690
    8791    return error;
Note: See TracChangeset for help on using the changeset viewer.