diff options
author | rsgowman <rgowman@google.com> | 2018-03-21 11:04:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-21 11:04:40 -0400 |
commit | 308acc09bfaf6dabf4b6d5f5e39f33854df8ce34 (patch) | |
tree | 3706bbbe40d08569795634fd2f30a07fd348b399 /Firestore/core/src/firebase/firestore/util | |
parent | d924771453d000e708bd5d239da3bae4feb489ac (diff) |
Change CredentialsProvider::TokenListener to use StatusOr<Token> (#945)
* Change CredentialsProvider::TokenListener to use StatusOr
Rather than a token plus error code/msg.
* Eliminate the concept of an invalid Token
Instead, we'll just use StatusOr<Token>. Note that unauthenticated
tokens are handled as a special case; they're created via:
Token::Unauthenticated()
and are otherwise "valid", though attempting to retrieve the raw token
on one of these tokens will cause an assertion failure.
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util')
-rw-r--r-- | Firestore/core/src/firebase/firestore/util/error_apple.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/error_apple.h b/Firestore/core/src/firebase/firestore/util/error_apple.h index e31cfd6..e7c77c9 100644 --- a/Firestore/core/src/firebase/firestore/util/error_apple.h +++ b/Firestore/core/src/firebase/firestore/util/error_apple.h @@ -24,6 +24,7 @@ #include "Firestore/Source/Public/FIRFirestoreErrors.h" // for FIRFirestoreErrorDomain #include "Firestore/core/include/firebase/firestore/firestore_errors.h" +#include "Firestore/core/src/firebase/firestore/util/status.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" #include "absl/strings/string_view.h" @@ -32,7 +33,7 @@ namespace firestore { namespace util { // Translates a set of error_code and error_msg to an NSError. -inline NSError* WrapNSError(const int64_t error_code, +inline NSError* MakeNSError(const int64_t error_code, const absl::string_view error_msg) { if (error_code == FirestoreErrorCode::Ok) { return nil; @@ -43,6 +44,10 @@ inline NSError* WrapNSError(const int64_t error_code, userInfo:@{NSLocalizedDescriptionKey : WrapNSString(error_msg)}]; } +inline NSError* MakeNSError(const util::Status& status) { + return MakeNSError(status.code(), status.error_message()); +} + } // namespace util } // namespace firestore } // namespace firebase |