From 1ceb4708f70c36fd87470e159ec46a437517fb64 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sat, 23 Mar 2019 12:06:02 -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: sahrens Differential Revision: D14570713 fbshipit-source-id: 57b0f993ba264a4949baf4022d807c55cdfe03b1 --- .../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..82d1556f7da 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 " << value; } 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(