-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error handling in storage SDKs #4999
Comments
This is related to the issue filed in the autorest repo: Azure/autorest.typescript#464 |
Is there an eta on when this will be sorted out? |
@ramya-rao-a Typescript generator related, please take a look. |
I think this is related to this issue, but the let uploadStatus = await uploadStreamToBlockBlob(
Aborter.timeout(30 * 60 * 1000), // Abort uploading with timeout in 30mins
fs.createReadStream(localFilePath),
blockBlobURL,
4 * 1024 * 1024, // 4MB block size
20, // 20 concurrency
);
let isSuccess = true;
let statusCode = uploadStatus._response.statusCode; // will be 201
let statusDescription = uploadStatus._response.bodyAsText; // will be empty |
We will follow up on the code generator side first and then come back here with an update |
The fix needs changes from both code generator and the core-http run-time. |
In the latest version of the storage libraries (12.0.0-preview.5), the error object is updated as below
#5796 will handle pulling these details up to be top level properties on the error object. |
Is your feature request related to a problem? Please describe.
Using @azure/storage-blob and other storage SDKs. We need to catch errors when invoking storage async APIs. However, the errors caught doesn't parser x-ms-error-code and other Azure Storage error message or descriptions from returned HTTP body. For example, when getting properties from non exist blob.
We need to retrieve the raw headers to get storage error code by
err.response.headers.get("x-ms-error-code")
.Describe the solution you'd like
A clear and concise description of what you want to happen.
Storage SDK uses protocol layer code generated by autorest-typescript from swagger. The swagger already defines how to parser storage error responses. But the generated code doesn't return errors defined in swagger.
The error thrown should parser error responses and fits the swagger definition correctly. For example, parser
ErrorCode
fromx-ms-error-code
header value.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Workaround is to wrap and handling the error parse in storage SDK side. But it's against the initial design about deserializtion should be done in protocol layer - generated code.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: