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:
parent
c4391567f3
commit
fea75365c7
1 changed files with 52 additions and 47 deletions
|
@ -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}) {
|
||||
|
|
Loading…
Add table
Reference in a new issue