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
This commit is contained in:
Родитель
06c1f3c502
Коммит
ce3952faf5
|
@ -10,6 +10,7 @@
|
||||||
#include <better/map.h>
|
#include <better/map.h>
|
||||||
#include <folly/Conv.h>
|
#include <folly/Conv.h>
|
||||||
#include <folly/dynamic.h>
|
#include <folly/dynamic.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
#include <react/components/view/primitives.h>
|
#include <react/components/view/primitives.h>
|
||||||
#include <react/core/LayoutMetrics.h>
|
#include <react/core/LayoutMetrics.h>
|
||||||
#include <react/graphics/Geometry.h>
|
#include <react/graphics/Geometry.h>
|
||||||
|
@ -143,12 +144,16 @@ inline void fromRawValue(const RawValue &value, YGDirection &result) {
|
||||||
result = YGDirectionRTL;
|
result = YGDirectionRTL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGDirection:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGFlexDirection &result) {
|
inline void fromRawValue(const RawValue &value, YGFlexDirection &result) {
|
||||||
assert(value.hasType<std::string>());
|
assert(value.hasType<std::string>());
|
||||||
auto stringValue = (std::string)value;
|
auto stringValue = (std::string)value;
|
||||||
|
if (stringValue == "row") {
|
||||||
|
result = YGFlexDirectionRow;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (stringValue == "column") {
|
if (stringValue == "column") {
|
||||||
result = YGFlexDirectionColumn;
|
result = YGFlexDirectionColumn;
|
||||||
return;
|
return;
|
||||||
|
@ -157,15 +162,11 @@ inline void fromRawValue(const RawValue &value, YGFlexDirection &result) {
|
||||||
result = YGFlexDirectionColumnReverse;
|
result = YGFlexDirectionColumnReverse;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (stringValue == "row") {
|
|
||||||
result = YGFlexDirectionRow;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (stringValue == "row-reverse") {
|
if (stringValue == "row-reverse") {
|
||||||
result = YGFlexDirectionRowReverse;
|
result = YGFlexDirectionRowReverse;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGFlexDirection:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGJustify &result) {
|
inline void fromRawValue(const RawValue &value, YGJustify &result) {
|
||||||
|
@ -195,7 +196,7 @@ inline void fromRawValue(const RawValue &value, YGJustify &result) {
|
||||||
result = YGJustifySpaceEvenly;
|
result = YGJustifySpaceEvenly;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGJustify:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGAlign &result) {
|
inline void fromRawValue(const RawValue &value, YGAlign &result) {
|
||||||
|
@ -233,7 +234,7 @@ inline void fromRawValue(const RawValue &value, YGAlign &result) {
|
||||||
result = YGAlignSpaceAround;
|
result = YGAlignSpaceAround;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGAlign:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGPositionType &result) {
|
inline void fromRawValue(const RawValue &value, YGPositionType &result) {
|
||||||
|
@ -247,7 +248,7 @@ inline void fromRawValue(const RawValue &value, YGPositionType &result) {
|
||||||
result = YGPositionTypeAbsolute;
|
result = YGPositionTypeAbsolute;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGPositionType:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGWrap &result) {
|
inline void fromRawValue(const RawValue &value, YGWrap &result) {
|
||||||
|
@ -265,7 +266,7 @@ inline void fromRawValue(const RawValue &value, YGWrap &result) {
|
||||||
result = YGWrapWrapReverse;
|
result = YGWrapWrapReverse;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGWrap:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGOverflow &result) {
|
inline void fromRawValue(const RawValue &value, YGOverflow &result) {
|
||||||
|
@ -283,7 +284,7 @@ inline void fromRawValue(const RawValue &value, YGOverflow &result) {
|
||||||
result = YGOverflowScroll;
|
result = YGOverflowScroll;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGOverflow:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, YGDisplay &result) {
|
inline void fromRawValue(const RawValue &value, YGDisplay &result) {
|
||||||
|
@ -297,7 +298,7 @@ inline void fromRawValue(const RawValue &value, YGDisplay &result) {
|
||||||
result = YGDisplayNone;
|
result = YGDisplayNone;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGDisplay:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(
|
inline void fromRawValue(
|
||||||
|
@ -337,7 +338,7 @@ inline void fromRawValue(const RawValue &value, YGFloatOptional &result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse YGFloatOptional";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Float toRadians(const RawValue &value) {
|
inline Float toRadians(const RawValue &value) {
|
||||||
|
@ -441,7 +442,7 @@ inline void fromRawValue(const RawValue &value, PointerEventsMode &result) {
|
||||||
result = PointerEventsMode::BoxOnly;
|
result = PointerEventsMode::BoxOnly;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse PointerEventsMode:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fromRawValue(const RawValue &value, BorderStyle &result) {
|
inline void fromRawValue(const RawValue &value, BorderStyle &result) {
|
||||||
|
@ -459,7 +460,7 @@ inline void fromRawValue(const RawValue &value, BorderStyle &result) {
|
||||||
result = BorderStyle::Dashed;
|
result = BorderStyle::Dashed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
abort();
|
LOG(FATAL) << "Could not parse BorderStyle:" << stringValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string toString(
|
inline std::string toString(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче