Description
openedon Jun 6, 2024
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
Assignees
Labels
Type
Projects
Status
Untriaged