import { ResponseError } from '@elastic/elasticsearch/lib/errors' ; export type UnauthorizedError = ResponseError & { statusCode : 401 ; } ; export function isResponseError ( error ) { return Boolean ( error . body && error . statusCode && error . headers ) ; } export function isUnauthorizedError ( error ) { return isResponseError ( error ) && error . statusCode === 401 ; }