From f5047af3bca60b67e4c89c7ea2bd251ad63b82e7 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Mon, 2 Nov 2015 11:13:30 -0800 Subject: [PATCH] Improve error messages inside RJSUtil --- src/js_util.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {