2025SELab2-project-Dwengo/frontend/src/exception/http-error-response-exception.ts
2025-04-01 15:09:28 +00:00

9 lines
348 B
TypeScript

import type { AxiosResponse } from "axios";
export class HttpErrorResponseException extends Error {
public statusCode: number;
constructor(public response: AxiosResponse<unknown, unknown>) {
super((response.data as { message: string })?.message || JSON.stringify(response.data));
this.statusCode = response.status;
}
}