Skip to content

Commit 6d3ec1d

Browse files
authored
Replace ThrowInvalidArgument with SimpleThrowInvalidArgument to fix iOS absl linker error in Unity SDK (#618)
1 parent cebf363 commit 6d3ec1d

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

firestore/src/main/firestore_main.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "app/src/include/firebase/future.h"
3636
#include "app/src/reference_counted_future_impl.h"
3737
#include "firebase/firestore/firestore_version.h"
38+
#include "firestore/src/common/exception_common.h"
3839
#include "firestore/src/common/hard_assert_common.h"
3940
#include "firestore/src/common/macros.h"
4041
#include "firestore/src/common/util.h"
@@ -55,7 +56,6 @@ using model::DatabaseId;
5556
using util::AsyncQueue;
5657
using util::Executor;
5758
using util::Status;
58-
using util::ThrowInvalidArgument;
5959

6060
std::shared_ptr<AsyncQueue> CreateWorkerQueue() {
6161
auto executor = Executor::CreateSerial("com.google.firebase.firestore");
@@ -86,8 +86,12 @@ LoadBundleTaskProgress ToApiProgress(
8686

8787
void ValidateDoubleSlash(const char* path) {
8888
if (std::strstr(path, "//") != nullptr) {
89-
ThrowInvalidArgument(
90-
"Invalid path (%s). Paths must not contain // in them.", path);
89+
// TODO(b/147444199): use string formatting.
90+
// ThrowInvalidArgument(
91+
// "Invalid path (%s). Paths must not contain // in them.", path);
92+
auto message = std::string("Invalid path (") + path +
93+
"). Paths must not contain // in them.";
94+
SimpleThrowInvalidArgument(message);
9195
}
9296
}
9397

@@ -138,10 +142,14 @@ DocumentReference FirestoreInternal::Document(const char* document_path) const {
138142

139143
Query FirestoreInternal::CollectionGroup(const char* collection_id) const {
140144
if (std::strchr(collection_id, '/') != nullptr) {
141-
ThrowInvalidArgument(
142-
"Invalid collection ID (%s). Collection IDs must not contain / in "
143-
"them.",
144-
collection_id);
145+
// TODO(b/147444199): use string formatting.
146+
// ThrowInvalidArgument(
147+
// "Invalid collection ID (%s). Collection IDs must not contain / in "
148+
// "them.",
149+
// collection_id);
150+
auto message = std::string("Invalid collection ID (") + collection_id +
151+
"). Collection IDs must not contain / in them.";
152+
SimpleThrowInvalidArgument(message);
145153
}
146154

147155
core::Query core_query = firestore_core_->GetCollectionGroup(collection_id);

firestore/src/main/transaction_main.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "Firestore/core/src/util/status.h"
2929
#include "Firestore/core/src/util/statusor.h"
3030
#include "absl/types/optional.h"
31+
#include "firestore/src/common/exception_common.h"
3132
#include "firestore/src/common/hard_assert_common.h"
3233
#include "firestore/src/main/converter_main.h"
3334
#include "firestore/src/main/document_reference_main.h"
@@ -45,7 +46,6 @@ using core::ParsedUpdateData;
4546
using model::Document;
4647
using util::Status;
4748
using util::StatusOr;
48-
using util::ThrowInvalidArgument;
4949

5050
const model::DocumentKey& GetKey(const DocumentReference& document) {
5151
return GetInternal(&document)->key();
@@ -183,7 +183,7 @@ void TransactionInternal::ValidateReference(const DocumentReference& document) {
183183
SIMPLE_HARD_ASSERT(internal_doc, "Invalid document reference provided.");
184184

185185
if (internal_doc->firestore() != firestore()) {
186-
ThrowInvalidArgument(
186+
SimpleThrowInvalidArgument(
187187
"Provided document reference is from a different Cloud Firestore "
188188
"instance.");
189189
}

0 commit comments

Comments
 (0)