mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 14:54:33 +00:00
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…
x
Reference in New Issue
Block a user