FIRStorageErrors.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2017 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 "FIRStorageConstants.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. @class FIRStorageReference;
  19. /**
  20. * Adds wrappers for common Firebase Storage errors (including creating errors from GCS errors).
  21. * For more information on unwrapping GCS errors, see the GCS errors docs:
  22. * https://cloud.google.com/storage/docs/json_api/v1/status-codes
  23. * This is never publicly exposed to end developers (as they will simply see an NSError).
  24. */
  25. @interface FIRStorageErrors : NSObject
  26. /**
  27. * Creates a Firebase Storage error from a specific FIRStorageErrorCode.
  28. */
  29. + (NSError *)errorWithCode:(FIRStorageErrorCode)code;
  30. /**
  31. * Creates a Firebase Storage error from a specific FIRStorageErrorCode while adding
  32. * custom info from an optionally provided info dictionary.
  33. */
  34. + (NSError *)errorWithCode:(FIRStorageErrorCode)code
  35. infoDictionary:(nullable NSDictionary *)dictionary;
  36. /**
  37. * Creates a Firebase Storage error from a specific GCS error and FIRStorageReference.
  38. * @param error Server error to wrap and return as a Firebase Storage error.
  39. * @param reference FIRStorageReference which provides context about the request being made.
  40. * @return Returns an Firebase Storage error, or nil if no error is provided.
  41. */
  42. + (nullable NSError *)errorWithServerError:(nullable NSError *)error
  43. reference:(nullable FIRStorageReference *)reference;
  44. @end
  45. NS_ASSUME_NONNULL_END