MCPcopy Create free account
hub / github.com/Borodutch/VideoDownloadBot / constructErrorMessage

Function constructErrorMessage

src/helpers/report.ts:28–46  ·  view source on GitHub ↗
(
  error: Error,
  { ctx, location, meta }: ExtraErrorInfo
)

Source from the content-addressed store, hash-verified

26}
27
28function 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
48async function sendToTelegramAdmin(error: Error, info: ExtraErrorInfo) {
49 try {

Callers 1

sendToTelegramAdminFunction · 0.85

Calls 1

escapeFunction · 0.85

Tested by

no test coverage detected