From 61d44326bfa324a731883030bc58d6a424a87c12 Mon Sep 17 00:00:00 2001 From: Teofilo Monteiro Date: Thu, 3 Oct 2024 17:41:26 +0200 Subject: [PATCH] improve the error typing in the formatted axios error (#99) --- src/api/base.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/base.ts b/src/api/base.ts index fe351b2..f676352 100644 --- a/src/api/base.ts +++ b/src/api/base.ts @@ -7,18 +7,18 @@ import { BASE_PATH } from '../openapi/base'; import { API_ACCESS_LEVELS, ApiContextLevel, ApiKeyLevel, PermitContextError } from './context'; -interface FormattedAxiosError { - code: string | undefined; +interface FormattedAxiosError { + code?: string; message: string; - error: any; - status: number | undefined; + error?: T; + status?: number; } export class PermitApiError extends Error { constructor(message: string, public originalError: AxiosError) { super(message); } - public get formattedAxiosError(): FormattedAxiosError { + public get formattedAxiosError(): FormattedAxiosError { return { code: this.originalError.code, message: this.message,