mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-23 21:10:01 +00:00
Don't discard the actual error message in validated_get_X
This commit is contained in:
parent
b8fd4fb861
commit
4ad75c9546
@ -232,7 +232,8 @@ ObjectSchema Schema<T>::parse_object_schema(ContextType ctx, ObjectType object_s
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
realm::Schema Schema<T>::parse_schema(ContextType ctx, ObjectType schema_object, ObjectDefaultsMap &defaults, ConstructorMap &constructors) {
|
||||
realm::Schema Schema<T>::parse_schema(ContextType ctx, ObjectType schema_object,
|
||||
ObjectDefaultsMap &defaults, ConstructorMap &constructors) {
|
||||
std::vector<ObjectSchema> schema;
|
||||
uint32_t length = Object::validated_get_length(ctx, schema_object);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "execution_context_id.hpp"
|
||||
#include "property.hpp"
|
||||
#include "util/format.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@ -223,7 +224,7 @@ struct Object {
|
||||
return Value<T>::validated_to_##type(ctx, get_property(ctx, object, key), std::string(key).c_str()); \
|
||||
} \
|
||||
catch (std::invalid_argument &e) { \
|
||||
throw message ? std::invalid_argument(message) : e; \
|
||||
throw message ? std::invalid_argument(util::format("Failed to read %1: %2", message, e.what())) : e; \
|
||||
} \
|
||||
} \
|
||||
static return_t validated_get_##type(ContextType ctx, const ObjectType &object, uint32_t index, const char *message = nullptr) { \
|
||||
@ -231,7 +232,7 @@ struct Object {
|
||||
return Value<T>::validated_to_##type(ctx, get_property(ctx, object, index)); \
|
||||
} \
|
||||
catch (std::invalid_argument &e) { \
|
||||
throw message ? std::invalid_argument(message) : e; \
|
||||
throw message ? std::invalid_argument(util::format("Failed to read %1: %2", message, e.what())) : e; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user