Improve error messages inside RJSUtil
This commit is contained in:
parent
381dbbe7ba
commit
f5047af3bc
|
@ -138,7 +138,7 @@ static inline JSValueRef RJSValidatedPropertyValue(JSContextRef ctx, JSObjectRef
|
|||
static inline JSObjectRef RJSValidatedObjectProperty(JSContextRef ctx, JSObjectRef object, JSStringRef property, const char *err = NULL) {
|
||||
JSValueRef propertyValue = RJSValidatedPropertyValue(ctx, object, property);
|
||||
if (JSValueIsUndefined(ctx, propertyValue)) {
|
||||
throw std::runtime_error(err ?: "Object property is undefined");
|
||||
throw std::runtime_error(err ?: "Object property '" + RJSStringForJSString(property) + "' is undefined");
|
||||
}
|
||||
return RJSValidatedValueToObject(ctx, propertyValue, err);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ static inline std::string RJSValidatedStringProperty(JSContextRef ctx, JSObjectR
|
|||
if (exception) {
|
||||
throw RJSException(ctx, exception);
|
||||
}
|
||||
return RJSValidatedStringForValue(ctx, propertyValue);
|
||||
return RJSValidatedStringForValue(ctx, propertyValue, RJSStringForJSString(property).c_str());
|
||||
}
|
||||
|
||||
static inline size_t RJSValidatedListLength(JSContextRef ctx, JSObjectRef object) {
|
||||
|
|
Loading…
Reference in New Issue