diff --git a/models/HubSpotAuthError.ts b/models/HubSpotAuthError.ts index bbf99b02..dc52c1d8 100644 --- a/models/HubSpotAuthError.ts +++ b/models/HubSpotAuthError.ts @@ -4,15 +4,22 @@ export class HubSpotAuthError extends Error { status?: number; category?: string; subCategory?: string; - constructor(message: string, { cause = {} }: { cause?: AxiosError }) { + constructor( + message: string, + { + cause = {}, + }: { + cause?: Partial>; + } + ) { super(message); this.name = 'HubSpotAuthError'; this.status = cause.status; - this.category = cause?.response?.body?.category || undefined; + this.category = cause?.response?.data?.category || undefined; this.subCategory = (cause.response && - cause.response.body && - cause.response.body.subCategory) || + cause.response.data && + cause.response.data.subCategory) || undefined; } }