Skip to content

Error is not processed by nest logger when wrong token is passed#1260

Description

@Maxttier

Generate error what is not handled by nest logger if wrong token is passed for example https://github.com/robot-mafia/nestjs-telegraf/blob/194419dc799f0872fcf4000a5e1266c462dac8c7/lib/utils/create-bot-factory.util.ts#L16

const bot = new Telegraf<any>(options.token, options.options);

  bot.use(...(options.middlewares ?? []));
  bot.catch((err, ctx) =>
    Logger.error(err, `Telegraf: ${ctx.botInfo.username}`), // that not help
  );

  if (options.launchOptions !== false) {
    bot.launch(options.launchOptions);  // here thrown error
  }

Can catch it with

if (options.launchOptions !== false) {
    bot
      .launch(options.launchOptions)
      .catch((err) => Logger.error(err.stack, 'Telegraf')); // that
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions