Skip to content

[Storage] Show more error information when cmdlet failed with StorageException #9433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2019

Conversation

blueww
Copy link
Member

@blueww blueww commented Jun 17, 2019

Description

Will add the information in StorageException.RequestInformation.ExtendedErrorInformation, which include: ErrorCode, ErrorMessage, ExtendedErrorInformation, if they exist

Such as for Set-AzStorageShareQuota, when input invalid quota, the original error is:

PS C:\temp>   Set-AzStorageShareQuota -ShareName $containerName -Quota 50000 -Context $ctx
Set-AzStorageShareQuota : The value for one of the HTTP headers is not in the correct format. HTTP Status Code: 400 - HTTP Error Message: The value for one of the HTTP headers is not 
in the correct format.
At line:1 char:1
+   Set-AzStorageShareQuota -ShareName $containerName -Quota 50000 -Con ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzStorageShareQuota], StorageException
    + FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageShareQuota

After change, the error is:

PS C:\temp>   Set-AzStorageShareQuota -ShareName $containerName -Quota 50000 -Context $ctx
Set-AzStorageShareQuota : The value for one of the HTTP headers is not in the correct format. HTTP Status Code: 400 - HTTP Error Message: The value for one of the HTTP headers is not 
in the correct format.
ErrorCode: InvalidHeaderValue
ErrorMessage: The value for one of the HTTP headers is not in the correct format.
RequestId:7a1f736b-101a-001a-5edd-24f3e4000000
Time:2019-06-17T07:23:11.8786920Z
HeaderName: x-ms-share-quota
HeaderValue: 50000
At line:1 char:3
+   Set-AzStorageShareQuota -ShareName $containerName -Quota 50000 -Con ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzStorageShareQuota], StorageException
    + FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageShareQuota

Checklist

@cormacpayne cormacpayne merged commit 6ba3164 into Azure:master Jun 17, 2019
@blueww
Copy link
Member Author

blueww commented Jun 18, 2019

@cormacpayne
Thanks for the quick review and merge!

@blueww blueww deleted the erromessage branch June 18, 2019 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants