public static AzureException GetExceptionFor(string requestId, HttpStatusCode statusCode, string errorCode, string statusDescription, Dictionary <string, string> details, WebException baseException) { switch (errorCode) { case "MessageTooLarge": return(new MessageTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidMarker": return(new InvalidMarkerAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PopReceiptMismatch": return(new PopReceiptMismatchAzureException(requestId, statusCode, statusDescription, details, baseException)); case "QueueNotFound": return(new QueueNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "MessageNotFound": return(new MessageNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "QueueDisabled": return(new QueueDisabledAzureException(requestId, statusCode, statusDescription, details, baseException)); case "QueueAlreadyExists": return(new QueueAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "QueueBeingDeleted": return(new QueueBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "QueueNotEmpty": return(new QueueNotEmptyAzureException(requestId, statusCode, statusDescription, details, baseException)); } switch (statusDescription) { case "The message exceeds the maximum allowed size.": return(new MessageTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified marker is invalid.": return(new InvalidMarkerAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified pop receipt did not match the pop receipt for a dequeued message.": return(new PopReceiptMismatchAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified queue does not exist.": return(new QueueNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified message does not exist.": return(new MessageNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified queue has been disabled by the administrator.": return(new QueueDisabledAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified queue already exists.": return(new QueueAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified queue is being deleted.": return(new QueueBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified queue is not empty.": return(new QueueNotEmptyAzureException(requestId, statusCode, statusDescription, details, baseException)); default: return(CommonServiceAzureExceptions.GetExceptionFor(requestId, statusCode, errorCode, statusDescription, details, baseException)); } }
public static AzureException GetExceptionFor(string requestId, HttpStatusCode statusCode, string errorCode, string statusDescription, Dictionary <string, string> details, WebException baseException) { switch (errorCode) { case "DuplicatePropertiesSpecified": return(new DuplicatePropertiesSpecifiedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "EntityAlreadyExists": return(new EntityAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "EntityTooLarge": return(new EntityTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "HostInformationNotPresent": return(new HostInformationNotPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidValueType": return(new InvalidValueTypeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "JsonFormatNotSupported": return(new JsonFormatNotSupportedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "MethodNotAllowed": return(new MethodNotAllowedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "NotImplemented": return(new NotImplementedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PropertiesNeedValue": return(new PropertiesNeedValueAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PropertyNameInvalid": return(new PropertyNameInvalidAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PropertyNameTooLong": return(new PropertyNameTooLongAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PropertyValueTooLarge": return(new PropertyValueTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "TableAlreadyExists": return(new TableAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "TableBeingDeleted": return(new TableBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "TableNotFound": return(new TableNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "TooManyProperties": return(new TooManyPropertiesAzureException(requestId, statusCode, statusDescription, details, baseException)); case "UpdateConditionNotSatisfied": return(new UpdateConditionNotSatisfiedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "XMethodIncorrectCount": return(new XMethodIncorrectCountAzureException(requestId, statusCode, statusDescription, details, baseException)); case "XMethodIncorrectValue": return(new XMethodIncorrectValueAzureException(requestId, statusCode, statusDescription, details, baseException)); case "XMethodNotUsingPost": return(new XMethodNotUsingPostAzureException(requestId, statusCode, statusDescription, details, baseException)); } switch (statusDescription) { case "A property is specified more than one time.": return(new DuplicatePropertiesSpecifiedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified entity already exists.": return(new EntityAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The entity is larger than the maximum size permitted.": return(new EntityTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The required host information is not present in the request. You must send a non-empty Host header or include the absolute URI in the request line.": return(new HostInformationNotPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The value specified is invalid.": return(new InvalidValueTypeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "JSON format is not supported.": return(new JsonFormatNotSupportedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The requested method is not allowed on the specified resource.": return(new MethodNotAllowedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The requested operation is not implemented on the specified resource.": return(new NotImplementedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "Values have not been specified for all properties in the entity.": return(new PropertiesNeedValueAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The property name is invalid.": return(new PropertyNameInvalidAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The property name exceeds the maximum allowed length.": return(new PropertyNameTooLongAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The property value is larger than the maximum size permitted.": return(new PropertyValueTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The table specified already exists.": return(new TableAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified table is being deleted.": return(new TableBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The table specified does not exist.": return(new TableNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The entity contains more properties than allowed.": return(new TooManyPropertiesAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The update condition specified in the request was not satisfied.": return(new UpdateConditionNotSatisfiedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "More than one X-HTTP-Method is specified.": return(new XMethodIncorrectCountAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified X-HTTP-Method is invalid.": return(new XMethodIncorrectValueAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The request uses X-HTTP-Method with an HTTP verb other than POST.": return(new XMethodNotUsingPostAzureException(requestId, statusCode, statusDescription, details, baseException)); default: return(CommonServiceAzureExceptions.GetExceptionFor(requestId, statusCode, errorCode, statusDescription, details, baseException)); } }
public static AzureException GetExceptionFor(string requestId, HttpStatusCode statusCode, string errorCode, string statusDescription, Dictionary <string, string> details, WebException baseException) { switch (errorCode) { case "InvalidBlobOrBlock": return(new InvalidBlobOrBlockAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidBlockId": return(new InvalidBlockIdAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidBlockList": return(new InvalidBlockListAzureException(requestId, statusCode, statusDescription, details, baseException)); case "ContainerNotFound": return(new ContainerNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "BlobNotFound": return(new BlobNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "ContainerAlreadyExists": return(new ContainerAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "ContainerDisabled": return(new ContainerDisabledAzureException(requestId, statusCode, statusDescription, details, baseException)); case "ContainerBeingDeleted": return(new ContainerBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "BlobAlreadyExists": return(new BlobAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseNotPresentWithBlobOperation": return(new LeaseNotPresentWithBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseNotPresentWithContainerOperation": return(new LeaseNotPresentWithContainerOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseLost": return(new LeaseLostAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIdMismatchWithBlobOperation": return(new LeaseIdMismatchWithBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIdMismatchWithContainerOperation": return(new LeaseIdMismatchWithContainerOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIdMissing": return(new LeaseIdMissingAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseNotPresentWithLeaseOperation": return(new LeaseNotPresentWithLeaseOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIdMismatchWithLeaseOperation": return(new LeaseIdMismatchWithLeaseOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseAlreadyPresent": return(new LeaseAlreadyPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseAlreadyBroken": return(new LeaseAlreadyBrokenAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIsBrokenAndCannotBeRenewed": return(new LeaseIsBrokenAndCannotBeRenewedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIsBreakingAndCannotBeAquired": return(new LeaseIsBreakingAndCannotBeAquiredAzureException(requestId, statusCode, statusDescription, details, baseException)); case "LeaseIsBreakingAndCannotBeChanged": return(new LeaseIsBreakingAndCannotBeChangedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InfiniteLeaseDurationRequired": return(new InfiniteLeaseDurationRequiredAzureException(requestId, statusCode, statusDescription, details, baseException)); case "SnapshotsPresent": return(new SnapshotsPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidBlobType": return(new InvalidBlobTypeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidVersionForPageBlobOperation": return(new InvalidVersionForPageBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "InvalidPageRange": return(new InvalidPageRangeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "SequenceNumberConditionNotMet": return(new SequenceNumberConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "SequenceNumberIncrementTooLarge": return(new SequenceNumberIncrementTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "SourceConditionNotMet": return(new SourceConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "TargetConditionNotMet": return(new TargetConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "CopyAcrossAccountsNotSupported": return(new CopyAcrossAccountsNotSupportedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "CannotVerifyCopySource": return(new CannotVerifyCopySourceAzureException(requestId, statusCode, statusDescription, details, baseException)); case "PendingCopyOperation": return(new PendingCopyOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "NoPendingCopyOperation": return(new NoPendingCopyOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "CopyIdMismatch": return(new CopyIdMismatchAzureException(requestId, statusCode, statusDescription, details, baseException)); } switch (statusDescription) { case "The specified blob or block content is invalid.": return(new InvalidBlobOrBlockAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified block ID is invalid. The block ID must be Base64-encoded.": return(new InvalidBlockIdAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified block list is invalid.": return(new InvalidBlockListAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified container does not exist.": return(new ContainerNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified blob does not exist.": return(new BlobNotFoundAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified container already exists.": return(new ContainerAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified container has been disabled by the administrator.": return(new ContainerDisabledAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified container is being deleted.": return(new ContainerBeingDeletedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified blob already exists.": return(new BlobAlreadyExistsAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently no lease on the blob.": return(new LeaseNotPresentWithBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently no lease on the container.": return(new LeaseNotPresentWithContainerOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "A lease ID was specified, but the lease for the blob/container has expired.": return(new LeaseLostAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID specified did not match the lease ID for the blob.": return(new LeaseIdMismatchWithBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID specified did not match the lease ID for the container.": return(new LeaseIdMismatchWithContainerOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently a lease on the blob/container and no lease ID was specified in the request.": return(new LeaseIdMissingAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently no lease on the blob/container.": return(new LeaseNotPresentWithLeaseOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID specified did not match the lease ID for the blob/container.": return(new LeaseIdMismatchWithLeaseOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is already a lease present.": return(new LeaseAlreadyPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease has already been broken and cannot be broken again.": return(new LeaseAlreadyBrokenAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID matched, but the lease has been broken explicitly and cannot be renewed.": return(new LeaseIsBrokenAndCannotBeRenewedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID matched, but the lease is currently in breaking state and cannot be acquired until it is broken.": return(new LeaseIsBreakingAndCannotBeAquiredAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID matched, but the lease is currently in breaking state and cannot be changed.": return(new LeaseIsBreakingAndCannotBeChangedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The lease ID matched, but the specified lease must be an infinite-duration lease.": return(new InfiniteLeaseDurationRequiredAzureException(requestId, statusCode, statusDescription, details, baseException)); case "This operation is not permitted because the blob has snapshots.": return(new SnapshotsPresentAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The blob type is invalid for this operation.": return(new InvalidBlobTypeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "All operations on page blobs require at least version 2009-09-19.": return(new InvalidVersionForPageBlobOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The page range specified is invalid.": return(new InvalidPageRangeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The sequence number condition specified was not met.": return(new SequenceNumberConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The sequence number increment cannot be performed because it would result in overflow of the sequence number.": return(new SequenceNumberIncrementTooLargeAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The source condition specified using HTTP conditional header(s) is not met.": return(new SourceConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The target condition specified using HTTP conditional header(s) is not met.": return(new TargetConditionNotMetAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The copy source account and destination account must be the same.": return(new CopyAcrossAccountsNotSupportedAzureException(requestId, statusCode, statusDescription, details, baseException)); case "Could not verify the copy source within the specified time. Examine the HTTP status code and message for more information about the failure.": return(new CannotVerifyCopySourceAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently a pending copy operation.": return(new PendingCopyOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "There is currently no pending copy operation.": return(new NoPendingCopyOperationAzureException(requestId, statusCode, statusDescription, details, baseException)); case "The specified copy ID did not match the copy ID for the pending copy operation.": return(new CopyIdMismatchAzureException(requestId, statusCode, statusDescription, details, baseException)); default: return(CommonServiceAzureExceptions.GetExceptionFor(requestId, statusCode, errorCode, statusDescription, details, baseException)); } }