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
This commit is contained in:
Родитель
f01a0d33ab
Коммит
1ceb4708f7
|
@ -10,6 +10,7 @@
|
|||
#include <better/map.h>
|
||||
#include <folly/Conv.h>
|
||||
#include <folly/dynamic.h>
|
||||
#include <glog/logging.h>
|
||||
#include <react/components/view/primitives.h>
|
||||
#include <react/core/LayoutMetrics.h>
|
||||
#include <react/graphics/Geometry.h>
|
||||
|
@ -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<std::string>());
|
||||
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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче