mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-07-17 16:16:59 +00:00
feat(gist): handle missing param error (#3101)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
import { request } from "../common/utils.js";
|
||||
import { request, MissingParamError } from "../common/utils.js";
|
||||
import { retryer } from "../common/retryer.js";
|
||||
|
||||
/**
|
||||
@@ -57,6 +57,7 @@ const fetcher = async (variables, token) => {
|
||||
* @returns {Promise<GistData>} Gist data.
|
||||
*/
|
||||
const fetchGist = async (id) => {
|
||||
if (!id) throw new MissingParamError(["id"], "/api/gist?id=GIST_ID");
|
||||
const res = await retryer(fetcher, { gistName: id });
|
||||
if (res.data.errors) throw new Error(res.data.errors[0].message);
|
||||
const data = res.data.data.viewer.gist;
|
||||
|
||||
Reference in New Issue
Block a user