From ce3952faf5d2e24fbcf9fa9d9f4b94fed8af4476 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sat, 23 Mar 2019 22:48:57 -0700 Subject: [PATCH] Replace abort() with LOG(FATAL) when a prop-value is not found during parsing Summary: This diff replaces usage of abort() with LOG(FATAL) when a prop-value is not found during parsing of prop values Reviewed By: fkgozali Differential Revision: D14591210 fbshipit-source-id: 4a8484ea6bdfec5534122ded43cc24ef80c13c1d --- .../fabric/components/view/conversions.h | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ReactCommon/fabric/components/view/conversions.h b/ReactCommon/fabric/components/view/conversions.h index b2a851ce11f..4599d87ea59 100644 --- a/ReactCommon/fabric/components/view/conversions.h +++ b/ReactCommon/fabric/components/view/conversions.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -143,12 +144,16 @@ inline void fromRawValue(const RawValue &value, YGDirection &result) { result = YGDirectionRTL; return; } - abort(); + LOG(FATAL) << "Could not parse YGDirection:" << stringValue; } inline void fromRawValue(const RawValue &value, YGFlexDirection &result) { assert(value.hasType()); auto stringValue = (std::string)value; + if (stringValue == "row") { + result = YGFlexDirectionRow; + return; + } if (stringValue == "column") { result = YGFlexDirectionColumn; return; @@ -157,15 +162,11 @@ inline void fromRawValue(const RawValue &value, YGFlexDirection &result) { result = YGFlexDirectionColumnReverse; return; } - if (stringValue == "row") { - result = YGFlexDirectionRow; - return; - } if (stringValue == "row-reverse") { result = YGFlexDirectionRowReverse; return; } - abort(); + LOG(FATAL) << "Could not parse YGFlexDirection:" << stringValue; } inline void fromRawValue(const RawValue &value, YGJustify &result) { @@ -195,7 +196,7 @@ inline void fromRawValue(const RawValue &value, YGJustify &result) { result = YGJustifySpaceEvenly; return; } - abort(); + LOG(FATAL) << "Could not parse YGJustify:" << stringValue; } inline void fromRawValue(const RawValue &value, YGAlign &result) { @@ -233,7 +234,7 @@ inline void fromRawValue(const RawValue &value, YGAlign &result) { result = YGAlignSpaceAround; return; } - abort(); + LOG(FATAL) << "Could not parse YGAlign:" << stringValue; } inline void fromRawValue(const RawValue &value, YGPositionType &result) { @@ -247,7 +248,7 @@ inline void fromRawValue(const RawValue &value, YGPositionType &result) { result = YGPositionTypeAbsolute; return; } - abort(); + LOG(FATAL) << "Could not parse YGPositionType:" << stringValue; } inline void fromRawValue(const RawValue &value, YGWrap &result) { @@ -265,7 +266,7 @@ inline void fromRawValue(const RawValue &value, YGWrap &result) { result = YGWrapWrapReverse; return; } - abort(); + LOG(FATAL) << "Could not parse YGWrap:" << stringValue; } inline void fromRawValue(const RawValue &value, YGOverflow &result) { @@ -283,7 +284,7 @@ inline void fromRawValue(const RawValue &value, YGOverflow &result) { result = YGOverflowScroll; return; } - abort(); + LOG(FATAL) << "Could not parse YGOverflow:" << stringValue; } inline void fromRawValue(const RawValue &value, YGDisplay &result) { @@ -297,7 +298,7 @@ inline void fromRawValue(const RawValue &value, YGDisplay &result) { result = YGDisplayNone; return; } - abort(); + LOG(FATAL) << "Could not parse YGDisplay:" << stringValue; } inline void fromRawValue( @@ -337,7 +338,7 @@ inline void fromRawValue(const RawValue &value, YGFloatOptional &result) { return; } } - abort(); + LOG(FATAL) << "Could not parse YGFloatOptional"; } inline Float toRadians(const RawValue &value) { @@ -441,7 +442,7 @@ inline void fromRawValue(const RawValue &value, PointerEventsMode &result) { result = PointerEventsMode::BoxOnly; return; } - abort(); + LOG(FATAL) << "Could not parse PointerEventsMode:" << stringValue; } inline void fromRawValue(const RawValue &value, BorderStyle &result) { @@ -459,7 +460,7 @@ inline void fromRawValue(const RawValue &value, BorderStyle &result) { result = BorderStyle::Dashed; return; } - abort(); + LOG(FATAL) << "Could not parse BorderStyle:" << stringValue; } inline std::string toString(