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

Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
Ophelia Goldstein
2025-10-11 20:57:00 +03:00
committed by GitHub
co-authored by Alexandr
parent 6d6b87c359
commit 0849165c6e
6 changed files with 105 additions and 10 deletions
+15
View File
@@ -1,3 +1,5 @@
// @ts-check
/**
* @type {string} A general message to ask user to try again later.
*/
@@ -61,9 +63,22 @@ class MissingParamError extends Error {
}
}
/**
* Retrieve secondary message from an error object.
*
* @param {Error} err The error object.
* @returns {string|undefined} The secondary message if available, otherwise undefined.
*/
const retrieveSecondaryMessage = (err) => {
return "secondaryMessage" in err && typeof err.secondaryMessage === "string"
? err.secondaryMessage
: undefined;
};
export {
CustomError,
MissingParamError,
SECONDARY_ERROR_MESSAGES,
TRY_AGAIN_LATER,
retrieveSecondaryMessage,
};