Skip to content

@azure/search-documents should export RestError #29928

Open
@jarpoole

Description

@jarpoole

Is your feature request related to a problem? Please describe.

Typescript only allows assigning a type of unknown or any to the caught argument in a catch block. I would like to extract the statusCode property so I would like to narrow the type using err instanceof RestError.

Describe the solution you'd like
@azure/search-documents should export RestError

Describe alternatives you've considered
Currently I am importing from @azure/core-rest-pipeline but this is suboptimal because the instanceof does NOT work across versions of the same package so there is no guarantee that the version of @azure/core-rest-pipeline I am using will stay aligned with the version used in the SDK.

Additional context

Closest issue I could find was #24945 which is for a completely different service and package but conveys a similar message that exporting error types is important for error handling!

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Searchcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

  • Status

    Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions