import { APIError, MessageContext } from "vk-io"; import { Composer } from "../composer"; import { logger } from "../logger"; export const composer = new Composer(); composer.use(async (ctx, next) => { try { await next(); } catch (err) { logger.error(err); } }); composer.use(async (ctx, next) => { try { await next(); } catch (err) { if (err instanceof APIError && err.code === 917) { logger.error('no access to the chat'); await ctx.send('хачю доступ к чату :=('); return; } throw err; } });