FIRInstallationsErrorUtil.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. + (NSError *)installationsErrorWithCode:(FIRInstallationsErrorCode)code
  42. failureReason:(nullable NSString *)failureReason
  43. underlyingError:(nullable NSError *)underlyingError;
  44. @end
  45. NS_ASSUME_NONNULL_END