Module: Twenty::Command::Hook::Rescue

Included in:
Connect, Console, Disconnect, Down, Migrate, Up
Defined in:
lib/twenty/cli/command/hook/rescue.rb

Constant Summary collapse

FRAME_MAX =
15
INDENT_BY =
2

Instance Method Summary collapse

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/twenty/cli/command/hook/rescue.rb', line 8

def run(...)
  super(...)
rescue => ex
  require "paint"
  $stderr.print "\n",
                "  ", Paint[" Exception ", :white, :red, :bold], "\n",
                "  ", Paint[ex.class.to_s, :bold], "\n",
                ex.message.each_line.map { [" " * INDENT_BY, _1] }.join,
                "\n\n",
                "  ", Paint[" Backtrace ", :white, :blue, :bold], "\n",
                format_backtrace(ex.backtrace), "\n",
                "\n"
end