Skip to content

Commit

Permalink
catch detail error
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Nov 8, 2024
1 parent 2a788bc commit ba463c8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/routes/csdn/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@ async function handler(ctx) {
const items = await Promise.all(
feed.items.map((item) =>
cache.tryGet(item.link, async () => {
const response = await got({
method: 'get',
url: item.link,
});
try {
const response = await got({
method: 'get',
url: item.link,
});

const $ = load(response.data);
const $ = load(response.data);

const description = $('#content_views').html();
const description = $('#content_views').html();

return {
...item,
description,
};
return {
...item,
description,
};
} catch {
return item;
}
})
)
);
Expand Down

0 comments on commit ba463c8

Please sign in to comment.