0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Updated guard for site data in Portal

closes https://github.com/TryGhost/Team/issues/2276

Portal had died with an unintelligible error about portal plans/includes being undefined when there was missing site data in some extreme edge cases. This change catches any errors in site transformation and logs it to console instead of crashing portal unexpectedly
This commit is contained in:
Rishabh 2023-01-13 21:01:58 +05:30
parent c4391567f3
commit fea75365c7

View file

@ -248,6 +248,7 @@ export function hasCommentsEnabled({site}) {
}
export function transformApiSiteData({site}) {
try {
if (!site) {
return null;
}
@ -310,6 +311,10 @@ export function transformApiSiteData({site}) {
}
return site;
} catch (error) {
/* eslint-disable no-console */
console.warn(`[Portal] Failed to read site data:`, error);
}
}
export function getAvailableProducts({site}) {