Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HttpError.toJSON() method #307

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Add HttpError.toJSON() method #307

merged 1 commit into from
Apr 13, 2023

Conversation

samchon
Copy link
Owner

@samchon samchon commented Apr 13, 2023

New method HttpError.toJSON() method for parsing response body.

export class HttpError extends Error {
    public readonly method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
    public readonly path: string;
    public readonly status: number;

    pubilc toJSON<T>(): HttpError.IProps<T>;
}
export namespace HttpError {
    export interface IProps<T> {
        method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
        path: string;
        status: number;
        message: T;
    }
}

@samchon samchon added the enhancement New feature or request label Apr 13, 2023
@samchon samchon self-assigned this Apr 13, 2023
@samchon samchon merged commit 02c99cf into v1.1 Apr 13, 2023
@samchon samchon deleted the features/fetch branch April 13, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant