mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Match convertRawProp error handling in iterator-based props parsing (#45156)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45156 We don't want to bubble up exceptions from props parsing, so match the behaviour from convertRawProp and fall back to the default value when an exception is encountered. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D59000397 fbshipit-source-id: f6f64a80fed98525cdd2a5b5d360c2d6ede76a12
This commit is contained in:
committed by
Facebook GitHub Bot
parent
88a9b6e89f
commit
2dfb09c51a
@@ -110,15 +110,19 @@
|
||||
struct, blockStart, prefix "BlockStart" suffix, rawValue)
|
||||
|
||||
// Rebuild a type that contains multiple fields from a single field value
|
||||
#define REBUILD_FIELD_SWITCH_CASE( \
|
||||
defaults, rawValue, property, field, fieldName) \
|
||||
case CONSTEXPR_RAW_PROPS_KEY_HASH(fieldName): { \
|
||||
if ((rawValue).hasValue()) { \
|
||||
decltype((defaults).field) res; \
|
||||
fromRawValue(context, rawValue, res); \
|
||||
(property).field = res; \
|
||||
} else { \
|
||||
(property).field = (defaults).field; \
|
||||
} \
|
||||
return; \
|
||||
#define REBUILD_FIELD_SWITCH_CASE( \
|
||||
defaults, rawValue, property, field, fieldName) \
|
||||
case CONSTEXPR_RAW_PROPS_KEY_HASH(fieldName): { \
|
||||
if ((rawValue).hasValue()) [[likely]] { \
|
||||
try { \
|
||||
fromRawValue(context, rawValue, (property).field); \
|
||||
} catch (const std::exception& e) { \
|
||||
LOG(ERROR) << "Error while converting prop '" << fieldName \
|
||||
<< "': " << e.what(); \
|
||||
(property).field = (defaults).field; \
|
||||
} \
|
||||
} else { \
|
||||
(property).field = (defaults).field; \
|
||||
} \
|
||||
return; \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user