Changeset 34075 in webkit for trunk/JavaScriptCore/VM/ExceptionHelpers.cpp
- Timestamp:
- May 23, 2008, 7:23:23 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/ExceptionHelpers.cpp
r33979 r34075 48 48 JSValue* createError(ExecState* exec, ErrorType e, const char* msg) 49 49 { 50 return Error::create(exec, e, msg, -1, -1, 0); // lineNo(), currentSourceId(exec), currentSourceURL(exec)50 return Error::create(exec, e, msg, -1, -1, 0); 51 51 } 52 52 … … 55 55 UString message = msg; 56 56 substitute(message, label.ustring()); 57 return Error::create(exec, e, message, -1, -1, 0); // lineNo(), currentSourceId(exec), currentSourceURL(exec)57 return Error::create(exec, e, message, -1, -1, 0); 58 58 } 59 59 … … 64 64 if (expr) 65 65 substitute(message, expr->toString()); 66 else 67 substitute(message, "<<no string for expression>>"); 68 return Error::create(exec, e, message, -1, -1, 0); //, lineNo(), currentSourceId(exec), currentSourceURL(exec)); 66 return Error::create(exec, e, message, -1, -1, 0); 67 } 68 69 JSValue* createError(ExecState* exec, ErrorType e, const char* msg, JSValue* v) 70 { 71 UString message = msg; 72 substitute(message, v->toString(exec)); 73 return Error::create(exec, e, message, -1, -1, 0); 69 74 } 70 75 … … 78 83 return createError(exec, ReferenceError, "Can't find variable: %s", ident); 79 84 } 80 81 JSValue* create NotAnObjectError(ExecState* exec, JSValue* value, Node* expr)85 86 JSValue* createInvalidParamError(ExecState* exec, const char* op, JSValue* v) 82 87 { 83 return createError(exec, TypeError, "Value %s (result of expression %s) is not an object.", value, expr); 88 UString message = "'%s' is not a valid argument for '%s'"; 89 substitute(message, v->toString(exec)); 90 substitute(message, op); 91 return Error::create(exec, TypeError, message, -1, -1, 0); 84 92 } 85 93 86 94 JSValue* createNotAConstructorError(ExecState* exec, JSValue* value, Node* expr) 87 95 { 88 if ( !value->isObject())89 return create NotAnObjectError(exec, value, expr);90 return createError(exec, TypeError, "Value %s (result of expression %s) is not a constructor. Cannot be used with new.", value, expr);96 if (expr) 97 return createError(exec, TypeError, "Value %s (result of expression %s) is not a constructor. Cannot be used with new.", value, expr); 98 return createError(exec, TypeError, "Value %s is not a constructor. Cannot be used with new.", value); 91 99 } 92 100 93 101 JSValue* createNotAFunctionError(ExecState* exec, JSValue* value, Node* expr) 94 102 { 95 if ( !value->isObject())96 return create NotAnObjectError(exec, value, expr);97 return createError(exec, TypeError, "Value %s (result of expression %s) does not allow function calls.", value, expr);103 if (expr) 104 return createError(exec, TypeError, "Value %s (result of expression %s) does not allow function calls.", value, expr); 105 return createError(exec, TypeError, "Value %s does not allow function calls.", value); 98 106 } 99 107
Note:
See TracChangeset
for help on using the changeset viewer.