aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core
diff options
context:
space:
mode:
authorGravatar rsgowman <rgowman@google.com>2018-04-10 14:48:18 -0400
committerGravatar GitHub <noreply@github.com>2018-04-10 14:48:18 -0400
commit59f9dcb72f46258ffefea3aaf93f51e927c1cc10 (patch)
tree237ea23f0d13ad4d23955aa52ec9b107485c12ce /Firestore/core
parent23742e81597fc6c17c7ec3636617bac27db15315 (diff)
FIREBASE_DEV_ASSERT -> FIREBASE_ASSERT within serializer.cc (#1062)
Diffstat (limited to 'Firestore/core')
-rw-r--r--Firestore/core/src/firebase/firestore/remote/serializer.cc30
1 files changed, 9 insertions, 21 deletions
diff --git a/Firestore/core/src/firebase/firestore/remote/serializer.cc b/Firestore/core/src/firebase/firestore/remote/serializer.cc
index 25f4979..ff135fd 100644
--- a/Firestore/core/src/firebase/firestore/remote/serializer.cc
+++ b/Firestore/core/src/firebase/firestore/remote/serializer.cc
@@ -176,9 +176,7 @@ void Writer::WriteTag(pb_wire_type_t wiretype, uint32_t field_number) {
if (!status_.ok()) return;
if (!pb_encode_tag(&stream_, wiretype, field_number)) {
- const char* errmsg = PB_GET_ERROR(&stream_);
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
+ FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_));
}
}
@@ -190,9 +188,7 @@ void Writer::WriteVarint(uint64_t value) {
if (!status_.ok()) return;
if (!pb_encode_varint(&stream_, value)) {
- const char* errmsg = PB_GET_ERROR(&stream_);
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
+ FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_));
}
}
@@ -257,9 +253,7 @@ void Writer::WriteString(const std::string& string_value) {
if (!pb_encode_string(
&stream_, reinterpret_cast<const pb_byte_t*>(string_value.c_str()),
string_value.length())) {
- const char* errmsg = PB_GET_ERROR(&stream_);
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
+ FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_));
}
}
@@ -408,20 +402,16 @@ void Writer::WriteNestedMessage(
// fail since sizing streams don't actually have any buffer space.)
if (stream_.callback == nullptr) {
if (!pb_write(&stream_, nullptr, size)) {
- const char* errmsg = PB_GET_ERROR(&stream_);
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
+ FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_));
}
return;
}
// Ensure the output stream has enough space
if (stream_.bytes_written + size > stream_.max_size) {
- const char* errmsg =
- "Insufficient space in the output stream to write the given message";
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
- return;
+ FIREBASE_ASSERT_MESSAGE(
+ false,
+ "Insufficient space in the output stream to write the given message");
}
// Use a substream to verify that a callback doesn't write more than what it
@@ -441,10 +431,8 @@ void Writer::WriteNestedMessage(
if (writer.bytes_written() != size) {
// submsg size changed
- const char* errmsg =
- "Parsing the nested message twice yielded different sizes";
- FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg);
- status_ = Status(FirestoreErrorCode::Internal, errmsg);
+ FIREBASE_ASSERT_MESSAGE(
+ false, "Parsing the nested message twice yielded different sizes");
}
}