FIRInstallationsErrorUtil.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/FIRInstallationsErrors.h>
  18. @class FIRInstallationsHTTPError;
  19. NS_ASSUME_NONNULL_BEGIN
  20. void FIRInstallationsItemSetErrorToPointer(NSError *error, NSError **pointer);
  21. @interface FIRInstallationsErrorUtil : NSObject
  22. + (NSError *)keyedArchiverErrorWithException:(NSException *)exception;
  23. + (NSError *)keyedArchiverErrorWithError:(NSError *)error;
  24. + (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status;
  25. + (NSError *)installationItemNotFoundForAppID:(NSString *)appID appName:(NSString *)appName;
  26. + (NSError *)JSONSerializationError:(NSError *)error;
  27. + (NSError *)networkErrorWithError:(NSError *)error;
  28. + (NSError *)FIDRegistrationErrorWithResponseMissingField:(NSString *)missingFieldName;
  29. + (FIRInstallationsHTTPError *)APIErrorWithHTTPResponse:(NSHTTPURLResponse *)HTTPResponse
  30. data:(nullable NSData *)data;
  31. + (BOOL)isAPIError:(NSError *)error withHTTPCode:(NSInteger)HTTPCode;
  32. /**
  33. * Returns the passed error if it is already in the public domain or a new error with the passed
  34. * error at `NSUnderlyingErrorKey`.
  35. */
  36. + (NSError *)publicDomainErrorWithError:(NSError *)error;
  37. @end
  38. NS_ASSUME_NONNULL_END