question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Core: When operation failed, need a better way to surface additional info

See original GitHub issue

Library name and version

Azure.AI.Translation.Document 1.0.0

Describe the bug

When you get failed request exception, ex.Message gives you something that requires additional parsing https://github.com/Azure/azure-sdk-for-net/blob/c3339441dc852529ac6647251bef9fc0dd5cef2d/sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslationOperation.cs#L230

Here is what ex.Message returns as a string

Cannot access source document location with the current permissions.
Status: 200 (OK)
ErrorCode: InvalidRequest

Additional Information:
AdditionalInformation: InvalidRequest: Cannot access source document location with the current permissions.
Target: Operation

Raw:
{"code":"InvalidRequest","message":"Cannot access source document location with the current permissions.","target":"Operation","innerError":{"code":"InvalidDocumentAccessLevel","message":"Cannot access source document location with the current permissions."}}

Content:


Headers:
Date: Tue, 06 Sep 2022 21:20:35 GMT
Server: Kestrel
Cache-Control: public, max-age=1
ETag: "A03DB87237F7C4A92D0B0F8A2E799E345C8A27A1E652D54D0B7653EF9D36E4B3"
Retry-After: 1
Transfer-Encoding: chunked
X-RequestId: 0HMKG9LI745IU:00000008
Content-Type: application/json; charset=utf-8

The user can get operation.status to get “InvalidRequest”, but there is no systematic way to get the actual message - “Cannot access source document …” or the inner error code “InvalidDocumentAccessLevel”.

Expected behavior

some way to access the message or inner error code. Maybe through the operation object? or through the exception object?

Actual behavior

exception is thrown but hard for user to parse

Reproduction Steps

submit a request to a path without access token or permission.

Environment

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pallavitcommented, Sep 8, 2022

This behavior is intentional. The thought process here is that any code written against other details isn’t safe. https://github.com/Azure/azure-sdk-for-net/issues/25384#issuecomment-972597959 this has a good explanation on why we chose to do it.

0reactions
annelo-msftcommented, Oct 20, 2022

Closing, per @pallavit’s comment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Operation failed as details for project could not be loaded ...
- The error 'The operation failed as details for project could not be loaded' appears in Visual Studio. Adding NuGet packages does work...
Read more >
Lesson Learned #237: Long running operation failed with ...
Additional Information. First of all, we need to know that all operations using Portal and REST-API are asyncronous calls using the Azure API ......
Read more >
VS2017 The operation failed as details for project could not ...
I try delete obj & bin folder, clear the nuget cache by tool>options. but the error still exist.
Read more >
Suppressing quantum errors by scaling a surface code ...
These results mark an experimental demonstration in which quantum error correction begins to improve performance with increasing qubit number, ...
Read more >
Error in repositioning the Datum Shape - Intergraph Smart 3D
Set the Corner Radius value to greater than or equal to zero. Distance Constraint: Direction of measurement does not intersect external surface.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found