Unverified Commit 056aaaf1 authored by Anurag Hazra's avatar Anurag Hazra Committed by GitHub
Browse files

fix: catched all errors (#384)

parent ec246d27
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ module.exports = async (req, res) => {
      parseBoolean(count_private),
      parseBoolean(include_all_commits)
    );
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }

    const cacheSeconds = clampValue(
      parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
@@ -49,7 +46,7 @@ module.exports = async (req, res) => {

    res.setHeader("Cache-Control", `public, max-age=${cacheSeconds}`);

  res.send(
    return res.send(
      renderStatsCard(stats, {
        hide: parseArray(hide),
        show_icons: parseBoolean(show_icons),
@@ -65,4 +62,7 @@ module.exports = async (req, res) => {
        theme,
      })
    );
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }
};
+27 −27
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@ module.exports = async (req, res) => {

  try {
    repoData = await fetchRepo(username, repo);
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }

    let cacheSeconds = clampValue(
      parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
@@ -52,7 +49,7 @@ module.exports = async (req, res) => {

    res.setHeader("Cache-Control", `public, max-age=${cacheSeconds}`);

  res.send(
    return res.send(
      renderRepoCard(repoData, {
        title_color,
        icon_color,
@@ -62,4 +59,7 @@ module.exports = async (req, res) => {
        show_owner: parseBoolean(show_owner),
      })
    );
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }
};
+22 −22
Original line number Diff line number Diff line
@@ -29,9 +29,6 @@ module.exports = async (req, res) => {

  try {
    topLangs = await fetchTopLanguages(username);
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }

    const cacheSeconds = clampValue(
      parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
@@ -41,7 +38,7 @@ module.exports = async (req, res) => {

    res.setHeader("Cache-Control", `public, max-age=${cacheSeconds}`);

  res.send(
    return res.send(
      renderTopLanguages(topLangs, {
        hide_title: parseBoolean(hide_title),
        hide_border: parseBoolean(hide_border),
@@ -54,4 +51,7 @@ module.exports = async (req, res) => {
        layout,
      })
    );
  } catch (err) {
    return res.send(renderError(err.message, err.secondaryMessage));
  }
};