Learn R Programming

telegram.bot (version 2.2.0)

ErrorHandler: Handling errors

Description

Handler class to handle errors in the Dispatcher.

Usage

ErrorHandler(callback)

is.ErrorHandler(x)

Arguments

callback

A function that takes (bot, error) as arguments.

x

Object to be tested.

Format

An R6Class object.

Examples

Run this code
# NOT RUN {
updater <- Updater(token = "TOKEN")

# Create error callback
error_callback <- function(bot, error){
  warning(simpleWarning(conditionMessage(error), call = "Updates polling"))
}

# Register it to the updater's dispatcher
updater$dispatcher$add_handler(ErrorHandler(error_callback))
# or
updater <- updater + ErrorHandler(error_callback)
# }

Run the code above in your browser using DataLab