Repository: anuraghazra/github-readme-stats
Pull request #3444 (2023-10-29 20:55:25)

refactor: improve blacklisted username error by adding secondary message

vercel[bot]: [vc]: #Kif3PxXnBa4eB/B1NTov9LzAyPjFmtmGEQyRxCXJRYE=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzL0R6TE1HVEtNTTNxa1JyanpEakpyeE5na3ZjU3QiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtcmVmYWN0by0zZDkwN2MtZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQifV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | ✅ Ready ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/DzLMGTKMM3qkRrjzDjJrxNgkvcSt)) | [Visit Preview](https://github-readme-stats-git-refacto-3d907c-github-readme-stats-team.vercel.app) | Oct 29, 2023 8:55pm |


codecov[bot]: We're currently processing your upload.  This comment will be updated when the results are available.

Patch:
diff --git a/api/index.js b/api/index.js
index e1e1c27..2029367 100644
--- a/api/index.js
+++ b/api/index.js
@@ -43,7 +43,7 @@ export default async (req, res) => {
 
   if (blacklist.includes(username)) {
     return res.send(
-      renderError("Something went wrong", "", {
+      renderError("Something went wrong", "This username is blacklisted", {
         title_color,
         text_color,
         bg_color,
diff --git a/api/pin.js b/api/pin.js
index bdad925..c67df29 100644
--- a/api/pin.js
+++ b/api/pin.js
@@ -30,7 +30,7 @@ export default async (req, res) => {
 
   if (blacklist.includes(username)) {
     return res.send(
-      renderError("Something went wrong", "", {
+      renderError("Something went wrong", "This username is blacklisted", {
         title_color,
         text_color,
         bg_color,
diff --git a/api/top-langs.js b/api/top-langs.js
index 0ca96fe..382ee42 100644
--- a/api/top-langs.js
+++ b/api/top-langs.js
@@ -38,7 +38,7 @@ export default async (req, res) => {
 
   if (blacklist.includes(username)) {
     return res.send(
-      renderError("Something went wrong", "", {
+      renderError("Something went wrong", "This username is blacklisted", {
         title_color,
         text_color,
         bg_color,


Test patch:
diff --git a/tests/api.test.js b/tests/api.test.js
index a6ed04b..0c0da38 100644
--- a/tests/api.test.js
+++ b/tests/api.test.js
@@ -291,7 +291,9 @@ describe("Test /api/", () => {
     await api(req, res);
 
     expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
-    expect(res.send).toBeCalledWith(renderError("Something went wrong"));
+    expect(res.send).toBeCalledWith(
+      renderError("Something went wrong", "This username is blacklisted"),
+    );
   });
 
   it("should render error card when wrong locale is provided", async () => {
diff --git a/tests/pin.test.js b/tests/pin.test.js
index 0dcb5aa..105e445 100644
--- a/tests/pin.test.js
+++ b/tests/pin.test.js
@@ -155,7 +155,9 @@ describe("Test /api/pin", () => {
     await pin(req, res);
 
     expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
-    expect(res.send).toBeCalledWith(renderError("Something went wrong"));
+    expect(res.send).toBeCalledWith(
+      renderError("Something went wrong", "This username is blacklisted"),
+    );
   });
 
   it("should render error card if wrong locale provided", async () => {
diff --git a/tests/top-langs.test.js b/tests/top-langs.test.js
index 272ee7e..692681b 100644
--- a/tests/top-langs.test.js
+++ b/tests/top-langs.test.js
@@ -183,7 +183,9 @@ describe("Test /api/top-langs", () => {
     await topLangs(req, res);
 
     expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
-    expect(res.send).toBeCalledWith(renderError("Something went wrong"));
+    expect(res.send).toBeCalledWith(
+      renderError("Something went wrong", "This username is blacklisted"),
+    );
   });
 
   it("should render error card if wrong locale provided", async () => {