fix(route/reuters): Fix empty authors & prevent unintended fallback (#21256)
* fix(route/reuters): Fix empty authors & prevent unintended fallback * Update lib/routes/reuters/common.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix error handling for FetchError in common.tsx * Update common.tsx --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
1520f4f30c
commit
2f9d18ccea
|
|
@ -257,7 +257,7 @@ async function handler(ctx) {
|
|||
guid: e.id,
|
||||
pubDate: parseDate(e.published_time),
|
||||
updated: parseDate(e.updated_time),
|
||||
author: e.authors.map((e) => e.name).join(', '),
|
||||
author: e.authors?.map((e) => e.name).join(', '),
|
||||
category: e.kicker.names,
|
||||
description: e.description,
|
||||
}));
|
||||
|
|
@ -329,7 +329,8 @@ async function handler(ctx) {
|
|||
link: `https://www.reuters.com${section_id}`,
|
||||
item: items,
|
||||
};
|
||||
} catch {
|
||||
} catch (error: any) {
|
||||
if (error?.name !== 'FetchError') { throw error; }
|
||||
// Fallback to arc outboundfeeds if API fails
|
||||
const arcUrl = topic ? `https://www.reuters.com/arc/outboundfeeds/v4/mobile/section${section_id}?outputType=json` : `https://www.reuters.com/arc/outboundfeeds/v4/mobile/section/${category}/?outputType=json`;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue