TwentyTwenty.Storage.Amazon.AmazonStorageExtensions.ToStorageException C# (CSharp) Method

ToStorageException() public static method

public static ToStorageException ( this asex ) : StorageException
asex this
return StorageException
        public static StorageException ToStorageException(this AmazonS3Exception asex)
        {
            switch (asex?.ErrorCode)
            {
                case "InvalidAccessKeyId":
                case "Forbidden":
                    return new StorageException(StorageErrorCode.InvalidCredentials, asex);
                case "InvalidSecurity":
                case "AccessDenied":
                case "AccountProblem":
                case "NotSignedUp":
                case "InvalidPayer":
                case "RequestTimeTooSkewed":
                case "SignatureDoesNotMatch":
                    return new StorageException(StorageErrorCode.InvalidAccess, asex);
                case "NoSuchBucket":
                case "NoSuchKey":
                case "NoSuchUpload":
                case "NoSuchVersion":
                    return new StorageException(StorageErrorCode.NotFound, asex);
                case "InvalidBucketName":
                case "KeyTooLong":
                    return new StorageException(StorageErrorCode.InvalidName, asex);
                default:
                    return new StorageException(StorageErrorCode.GenericException, asex);
            }
        }
    }