Class: Facebook::Messenger::ServerNoError

Inherits:
Server
  • Object
show all
Defined in:
lib/facebook/messenger/server_no_error.rb

Overview

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

Constant Summary collapse

SCREAMING_FACE =
"\xF0\x9F\x98\xB1".freeze
MAX_MESSAGE_LENGTH =
639

Instance Method Summary collapse

Methods inherited from Server

call

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# 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