Skip to content

Commit

Permalink
improve the error typing in the formatted axios error (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
teofilomonteiro authored Oct 3, 2024
1 parent 65923e7 commit 61d4432
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
code?: string;
message: string;
error: any;
status: number | undefined;
error?: T;
status?: number;
}
export class PermitApiError<T> extends Error {
constructor(message: string, public originalError: AxiosError<T>) {
super(message);
}

public get formattedAxiosError(): FormattedAxiosError {
public get formattedAxiosError(): FormattedAxiosError<T> {
return {
code: this.originalError.code,
message: this.message,
Expand Down

0 comments on commit 61d4432

Please sign in to comment.