Skip to content

0.0.9

Compare
Choose a tag to compare
@fzn0x fzn0x released this 09 May 02:49
· 68 commits to main since this release

What's New?

Introducing new HTTP error for Hypf, now you can handle HTTP errors easily if response was not ok (200)

export function createHTTPError(response: Response, responseData: Response) {
  const code = response.status || response.status === 0 ? response.status : "";
  const title = response.statusText || "";
  const status = `${code} ${title}`.trim();
  const reason = status ? `status code ${status}` : "an unknown error";
  const error = new Error(reason);

  error.name = "HTTPError";

  (error as any).response = response;
  (error as any).data = responseData;

  return error;
}

Full Changelog: 0.0.8...0.0.9