0.3.0 • Published 1 year ago
tgreports v0.3.0
Telegram Reports
Telegram Reports catches errors and sends them to your Telegram.
Get Started
In Telegram message to @tgcatcherbot and get your ID (123456789 for example).
Usage
Message Sender
Use to manually send messages.
sendMessage("message sender", { userId: 123456789 })
Errors Sender
Use to manually send errors logs.
const error = new Error("error sender")
sendError(error, { userId: 123456789 })
Function Scope
Catch errors thrown in the top layer of a specific function. Does not include errors thrown by nested functions and async functions used without await
, so remember to handle them.
const fun = () => {
throw new Error("function scope error")
}
functionScopeCatcher(fun, { userId: 123456789 }, { log: true, crash: false })
Global Scope
Catches all unhandled errors/exceptions of the process.
globalScopeCatcher({ userId: 123456789 }, { log: true, crash: false })