FIRInstallationsErrorUtil.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. + (NSError *)corruptedIIDTokenData;
  30. + (FIRInstallationsHTTPError *)APIErrorWithHTTPResponse:(NSHTTPURLResponse *)HTTPResponse
  31. data:(nullable NSData *)data;
  32. + (BOOL)isAPIError:(NSError *)error withHTTPCode:(NSInteger)HTTPCode;
  33. /**
  34. * Returns the passed error if it is already in the public domain or a new error with the passed
  35. * error at `NSUnderlyingErrorKey`.
  36. */
  37. + (NSError *)publicDomainErrorWithError:(NSError *)error;
  38. @end
  39. NS_ASSUME_NONNULL_END