Skip to content

[Text translation] TextTranslationClient error type mismatch: ErrorResponseOutput #27403

Open

Description

  • @azure-rest/ai-translation-text:
  • 1.0.0-beta.1:
  • MacOS:
  • nodejs
    • 18.18.0:
  • browser
    • n/a:
  • typescript
    • 5.2.2:
  • Is the bug related to documentation in

Describe the bug
Using TextTranslationClient, and receiving an error response. The response.body returned by the client is a string. e.g. body: '{"error":{"code":401000,"message":"The request is not authorized because credentials are missing or invalid."}}' but the type defined in @azure-rest/ai-translation-text/types/ai-translation-text.d.ts is ErrorResponseOutput which is an object containing error: ErrorDetailsOutput.

To Reproduce
Steps to reproduce the behavior:

  1. Trigger any error using the TextTranslationClient
  2. Attempt to reference res.body.error.message
  3. Get an error, Uncaught TypeError: Cannot read properties of undefined (reading 'message')

Expected behavior
Either the response body is typed as a string, or the body is returned parsed as an object to match it's type definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Cognitive - TranslatorService AttentionWorkflow: This issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions