fix: resolve vscode type errors in API endpoints files (#4555)

Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
Ophelia GoldsteinandAlexandr authored and GitHub committed 2025-10-11 20:57:00 +03:00
1 parent 6d6b87c359
commit 0849165c6e
6 files changed
+105 -10

No files matched your search

+18 -2
View File
@@ -8,10 +8,12 @@ import {
setCacheHeaders,
setErrorCacheHeaders,
} from "../src/common/cache.js";
import { retrieveSecondaryMessage } from "../src/common/error.js";
import { parseBoolean, renderError } from "../src/common/utils.js";
import { fetchRepo } from "../src/fetchers/repo.js";
import { isLocaleAvailable } from "../src/translations.js";
// @ts-ignore
export default async (req, res) => {
const {
username,
@@ -92,10 +94,24 @@ export default async (req, res) => {
);
} catch (err) {
setErrorCacheHeaders(res);
if (err instanceof Error) {
return res.send(
renderError({
message: err.message,
secondaryMessage: retrieveSecondaryMessage(err),
renderOptions: {
title_color,
text_color,
bg_color,
border_color,
theme,
},
}),
);
}
return res.send(
renderError({
message: err.message,
secondaryMessage: err.secondaryMessage,
message: "An unknown error occurred",
renderOptions: {
title_color,
text_color,