SDWebImageError.h 2.5 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * This file is part of the SDWebImage package.
  3. * (c) Olivier Poitrey <rs@dailymotion.com>
  4. * (c) Jamie Pinkham
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. #import "SDWebImageCompat.h"
  10. /// An error domain represent SDWebImage loading system with custom codes
  11. FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain;
  12. /// The response instance for invalid download response (NSURLResponse *)
  13. FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey;
  14. /// The HTTP status code for invalid download response (NSNumber *)
  15. FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey;
  16. /// The HTTP MIME content type for invalid download response (NSString *)
  17. FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey;
  18. /// SDWebImage error domain and codes
  19. typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {
  20. SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL
  21. SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty
  22. SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached`
  23. SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this
  24. SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized
  25. SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey`
  26. SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code.
  27. SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed.
  28. SDWebImageErrorInvalidDownloadContentType = 2004, // The image download response a invalid content type. You can check the MIME content type in error's userInfo under `SDWebImageErrorDownloadContentTypeKey`
  29. };