Skip to content
This repository was archived by the owner on Dec 2, 2023. It is now read-only.

Commit e4a71f0

Browse files
authored
Merge pull request #73 from kei711/feature/add-error-handling
2 parents 3479eef + 0ef53ec commit e4a71f0

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

renovate.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
":label(renovate)",
5-
":semanticCommits",
6-
":timezone(Asia/Tokyo)",
7-
"config:base"
8-
],
3+
"extends": [":label(renovate)", ":semanticCommits", ":timezone(Asia/Tokyo)", "config:base"],
94
"dependencyDashboard": true,
105
"platformAutomerge": true,
116
"rebaseWhen": "auto",

src/index.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ app.event('link_shared', async ({ event, client, logger }) => {
3030
const [, posts, postId] = new URL(link.url).pathname.split('/');
3131
logger.debug({ posts, postId });
3232

33-
const post = await docbase.fetchPost(postId);
33+
const post = await docbase.fetchPost(postId).catch((e) => {
34+
logger.error(e.message);
35+
});
3436
logger.debug(post);
3537
if (!post) {
3638
// Not found
@@ -53,11 +55,15 @@ app.event('link_shared', async ({ event, client, logger }) => {
5355
footer: 'Tags: ' + post.tags.map((v) => v.name).join(', '),
5456
ts: dayjs(post.updated_at).unix().toString(),
5557
};
56-
await client.chat.unfurl({
57-
channel: event.channel,
58-
ts: event.message_ts,
59-
unfurls: { [post.url]: attachment },
60-
});
58+
await client.chat
59+
.unfurl({
60+
channel: event.channel,
61+
ts: event.message_ts,
62+
unfurls: { [post.url]: attachment },
63+
})
64+
.catch((e) => {
65+
logger.error(e.message);
66+
});
6167
}
6268
});
6369

0 commit comments

Comments
 (0)