Yuki Takei 5 лет назад
Родитель
Сommit
df8bdf80f4
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      packages/slackbot-proxy/src/middlewares/authorizer.ts

+ 6 - 4
packages/slackbot-proxy/src/middlewares/authorizer.ts

@@ -50,13 +50,14 @@ export class AuthorizeCommandMiddleware implements IMiddleware {
       result = await this.installerService.installer.authorize(query);
 
       if (result.botToken == null) {
-        throw new Error(`The installation for the team(${teamId || enterpriseId}) has no botToken`);
+        res.writeHead(403, `The installation for the team(${teamId || enterpriseId}) has no botToken`);
+        return res.end();
       }
     }
     catch (e) {
       this.logger.error(e.message);
 
-      res.writeHead(403, e.message);
+      res.writeHead(500, e.message);
       return res.end();
     }
 
@@ -109,13 +110,14 @@ export class AuthorizeInteractionMiddleware implements IMiddleware {
       result = await this.installerService.installer.authorize(query);
 
       if (result.botToken == null) {
-        throw new Error(`The installation for the team(${teamId || enterpriseId}) has no botToken`);
+        res.writeHead(403, `The installation for the team(${teamId || enterpriseId}) has no botToken`);
+        return res.end();
       }
     }
     catch (e) {
       this.logger.error(e.message);
 
-      res.writeHead(403, e.message);
+      res.writeHead(500, e.message);
       return res.end();
     }