(
error: Error,
{ ctx, location, meta }: ExtraErrorInfo
)
| 26 | } |
| 27 | |
| 28 | function constructErrorMessage( |
| 29 | error: Error, |
| 30 | { ctx, location, meta }: ExtraErrorInfo |
| 31 | ) { |
| 32 | const { message } = error |
| 33 | const chatInfo = |
| 34 | ctx?.chat?.id || ctx?.callbackQuery?.message?.chat.id |
| 35 | ? [`Chat <b>${ctx.chat?.id || ctx.callbackQuery?.message?.chat.id}</b>`] |
| 36 | : [] |
| 37 | if (ctx?.chat && 'username' in ctx.chat) { |
| 38 | chatInfo.push(`@${ctx.chat.username}`) |
| 39 | } |
| 40 | const result = `${ |
| 41 | location ? `<b>${escape(location)}</b>${ctx ? '\n' : ''}` : '' |
| 42 | }${chatInfo.filter((v) => !!v).join(', ')}\n${escape(message)}${ |
| 43 | meta ? `\n<code>${meta}</code>` : '' |
| 44 | }` |
| 45 | return result |
| 46 | } |
| 47 | |
| 48 | async function sendToTelegramAdmin(error: Error, info: ExtraErrorInfo) { |
| 49 | try { |
no test coverage detected