FIRInstallationsErrorUtil.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FirebaseInstallations/Source/Library/Public/FirebaseInstallations/FIRInstallationsErrors.h"
  18. @class FIRInstallationsHTTPError;
  19. @class FBLPromise<ResultType>;
  20. NS_ASSUME_NONNULL_BEGIN
  21. void FIRInstallationsItemSetErrorToPointer(NSError *error, NSError **pointer);
  22. @interface FIRInstallationsErrorUtil : NSObject
  23. + (NSError *)keyedArchiverErrorWithException:(NSException *)exception;
  24. + (NSError *)keyedArchiverErrorWithError:(NSError *)error;
  25. + (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status;
  26. + (NSError *)installationItemNotFoundForAppID:(NSString *)appID appName:(NSString *)appName;
  27. + (NSError *)JSONSerializationError:(NSError *)error;
  28. + (NSError *)networkErrorWithError:(NSError *)error;
  29. + (NSError *)FIDRegistrationErrorWithResponseMissingField:(NSString *)missingFieldName;
  30. + (NSError *)corruptedIIDTokenData;
  31. + (FIRInstallationsHTTPError *)APIErrorWithHTTPResponse:(NSHTTPURLResponse *)HTTPResponse
  32. data:(nullable NSData *)data;
  33. + (BOOL)isAPIError:(NSError *)error withHTTPCode:(NSInteger)HTTPCode;
  34. + (NSError *)backoffIntervalWaitError;
  35. /**
  36. * Returns the passed error if it is already in the public domain or a new error with the passed
  37. * error at `NSUnderlyingErrorKey`.
  38. */
  39. + (NSError *)publicDomainErrorWithError:(NSError *)error;
  40. + (FBLPromise *)rejectedPromiseWithError:(NSError *)error;
  41. @end
  42. NS_ASSUME_NONNULL_END