Skip to content

Replace ThrowInvalidArgument with SimpleThrowInvalidArgument to fix iOS absl linker error in Unity SDK #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions firestore/src/main/firestore_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "app/src/include/firebase/future.h"
#include "app/src/reference_counted_future_impl.h"
#include "firebase/firestore/firestore_version.h"
#include "firestore/src/common/exception_common.h"
#include "firestore/src/common/hard_assert_common.h"
#include "firestore/src/common/macros.h"
#include "firestore/src/common/util.h"
Expand All @@ -55,7 +56,6 @@ using model::DatabaseId;
using util::AsyncQueue;
using util::Executor;
using util::Status;
using util::ThrowInvalidArgument;

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

void ValidateDoubleSlash(const char* path) {
if (std::strstr(path, "//") != nullptr) {
ThrowInvalidArgument(
"Invalid path (%s). Paths must not contain // in them.", path);
// TODO(b/147444199): use string formatting.
// ThrowInvalidArgument(
// "Invalid path (%s). Paths must not contain // in them.", path);
auto message = std::string("Invalid path (") + path +
"). Paths must not contain // in them.";
SimpleThrowInvalidArgument(message);
}
}

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

Query FirestoreInternal::CollectionGroup(const char* collection_id) const {
if (std::strchr(collection_id, '/') != nullptr) {
ThrowInvalidArgument(
"Invalid collection ID (%s). Collection IDs must not contain / in "
"them.",
collection_id);
// TODO(b/147444199): use string formatting.
// ThrowInvalidArgument(
// "Invalid collection ID (%s). Collection IDs must not contain / in "
// "them.",
// collection_id);
auto message = std::string("Invalid collection ID (") + collection_id +
"). Collection IDs must not contain / in them.";
SimpleThrowInvalidArgument(message);
}

core::Query core_query = firestore_core_->GetCollectionGroup(collection_id);
Expand Down
4 changes: 2 additions & 2 deletions firestore/src/main/transaction_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Firestore/core/src/util/status.h"
#include "Firestore/core/src/util/statusor.h"
#include "absl/types/optional.h"
#include "firestore/src/common/exception_common.h"
#include "firestore/src/common/hard_assert_common.h"
#include "firestore/src/main/converter_main.h"
#include "firestore/src/main/document_reference_main.h"
Expand All @@ -45,7 +46,6 @@ using core::ParsedUpdateData;
using model::Document;
using util::Status;
using util::StatusOr;
using util::ThrowInvalidArgument;

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

if (internal_doc->firestore() != firestore()) {
ThrowInvalidArgument(
SimpleThrowInvalidArgument(
"Provided document reference is from a different Cloud Firestore "
"instance.");
}
Expand Down