kaori 4 lat temu
rodzic
commit
cc790e6b1c
1 zmienionych plików z 12 dodań i 9 usunięć
  1. 12 9
      packages/slackbot-proxy/src/controllers/slack.ts

+ 12 - 9
packages/slackbot-proxy/src/controllers/slack.ts

@@ -8,6 +8,7 @@ import { WebAPICallResult } from '@slack/web-api';
 
 import {
   markdownSectionBlock, GrowiCommand, parseSlashCommand, postEphemeralErrors, verifySlackRequest, generateWebClient,
+  InvalidGrowiCommandError,
 } from '@growi/slack';
 
 import { Relation } from '~/entities/relation';
@@ -110,15 +111,17 @@ export class SlackCtrl {
     try {
       growiCommand = parseSlashCommand(body);
     }
-    catch (e) {
-      console.log('errorでたaaa');
-      res.json({
-        blocks: [
-          markdownSectionBlock('*No relation found.*'),
-          markdownSectionBlock('Run `/growi register` first.'),
-        ],
-      });
-      // res.send();
+    catch (err) {
+      if (err instanceof InvalidGrowiCommandError) {
+        res.json({
+          blocks: [
+            markdownSectionBlock('*Command type is not specified.*'),
+            markdownSectionBlock('Run `/growi help` to check the commands you can use.'),
+          ],
+        });
+      }
+      logger.error(err.message);
+      return;
     }
 
     // register