Skip to content

Commit

Permalink
Add return interface to formattedAxiosError getterr
Browse files Browse the repository at this point in the history
  • Loading branch information
gideonsmila committed Sep 19, 2024
1 parent a0a8334 commit 794dbc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ import { BASE_PATH } from '../openapi/base';

import { API_ACCESS_LEVELS, ApiContextLevel, ApiKeyLevel, PermitContextError } from './context';

interface FormattedAxiosError {
code: string | undefined;
message: string;
error: any;
status: number | undefined;
}
export class PermitApiError<T> extends Error {
constructor(message: string, public originalError: AxiosError<T>) {
super(message);
}

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

0 comments on commit 794dbc3

Please sign in to comment.