
You can determine if the module is using LWP::UserAgent or Mojo::UserAgent by using isa: my $is_lwp = $user_agent->isa ('LWP::UserAgent') USING A PROXY Returns the instance of the user-agent used by the module. Unknown specifies an error with no known source. This may indicate a network issue, a non-200 HTTP response code or any error not related to the API. When type is api, the key code is guaranteed to exist.Īgent specifies an error originating from this module's user-agent. This method accepts an error message as its first argument, otherwise is used.Īn hash reference containing the following elements is returned:Īpi specifies an error originating from Telegram's BotAPI. WARNING: up until version 0.09, this method incorrectly stopped at the first occurence of at in error messages, producing results such as missing ch instead of missing chat. When sandboxing calls to WWW::Telegram::BotAPI methods using eval, it is useful to parse error messages using this method.

My $error = $api->parse_error ($message) # Or, use it with a custom error message.

# Handle error gracefully using "type", "msg" and "code" (optional) Or die 'Got error message: ', $api->parse_error-> eq 'unknown' # The API methods die when an error occurs.

WWW::Telegram::BotAPI - Perl implementation of the Telegram Bot API SYNOPSIS use WWW::Telegram::BotAPI
