Skip to content

Commit

Permalink
Remove exceptions from MapBufferBuilder class
Browse files Browse the repository at this point in the history
Summary:
In Fabric we don't throw exception. This diff removes exception from MapBufferBuilder class

changelog: [internal] internal

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D27303493

fbshipit-source-id: 8303bb4be786e2ea175b6741ec536c0f54615001
  • Loading branch information
mdvacca authored and facebook-github-bot committed Mar 25, 2021
1 parent 0b5fbf3 commit 3bbb0a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void MapBufferBuilder::ensureKeyValueSpace() {
LOG(ERROR)
<< "Error: trying to assign a value beyond the capacity of uint16_t"
<< static_cast<uint32_t>(keyValuesSize_) * 2;
throw "Error: trying to assign a value beyond the capacity of uint16_t";
abort();
}
keyValuesSize_ *= 2;
uint8_t *newKeyValues = new Byte[keyValuesSize_];
Expand All @@ -50,10 +50,12 @@ void MapBufferBuilder::ensureKeyValueSpace() {
void MapBufferBuilder::storeKeyValue(Key key, uint8_t *value, int valueSize) {
if (key < minKeyToStore_) {
LOG(ERROR) << "Error: key out of order - key: " << key;
throw "Error: key out of order";
abort();
}
if (valueSize > MAX_VALUE_SIZE) {
throw "Error: size of value must be <= MAX_VALUE_SIZE";
LOG(ERROR) << "Error: size of value must be <= MAX_VALUE_SIZE. ValueSize: "
<< valueSize;
abort();
}
// TODO: header.count points to the next index
// TODO: add test to verify storage of sparse keys
Expand Down Expand Up @@ -107,7 +109,7 @@ void MapBufferBuilder::ensureDynamicDataSpace(int size) {
LOG(ERROR)
<< "Error: trying to assign a value beyond the capacity of uint16_t"
<< static_cast<uint32_t>(dynamicDataSize_) * 2;
throw "Error: trying to assign a value beyond the capacity of uint16_t";
abort();
}
dynamicDataSize_ *= 2;
uint8_t *newDynamicDataValues = new Byte[dynamicDataSize_];
Expand Down

0 comments on commit 3bbb0a4

Please sign in to comment.