class Facebook::Messenger::ServerNoError

Server rescuing all errors sending the backtrace back to the chat FOR DEVELOPPING PURPOSE

Constants

MAX_MESSAGE_LENGTH
SCREAMING_FACE

Public Instance Methods

call(env) click to toggle source
Calls superclass method Facebook::Messenger::Server::call
# File lib/facebook/messenger/server_no_error.rb, line 11
def call(env)
  super
rescue Exception => e # rubocop:disable Lint/RescueException
  send(SCREAMING_FACE)
  send(e.inspect)
  send(e.backtrace.join("\n")[0..MAX_MESSAGE_LENGTH - 3] + '...')

  @response.status = 200
  @response.finish
end

Private Instance Methods

send(text) click to toggle source
# File lib/facebook/messenger/server_no_error.rb, line 28
def send(text)
  Bot.deliver({
                recipient: sender,
                message: { text: text }
              }, access_token: ENV['ACCESS_TOKEN'])
end
sender() click to toggle source
# File lib/facebook/messenger/server_no_error.rb, line 24
def sender
  parsed_body['entry'][0]['messaging'][0]['sender']
end