diff --git a/src/js_util.hpp b/src/js_util.hpp index 6967f80a..c530e4e5 100644 --- a/src/js_util.hpp +++ b/src/js_util.hpp @@ -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) {