Update rescue.rb

This commit is contained in:
0x1eef 2024-05-23 22:35:51 -03:00
parent 4f162796b0
commit b0d6c19ab4

View file

@ -2,8 +2,8 @@
module Twenty::Command::Hook
module Rescue
FRAME_MAX = 15
INDENT_BY = 2
FRAMEMAX = 15
INDENTBY = 2
def run(...)
super(...)
@ -12,7 +12,7 @@ module Twenty::Command::Hook
$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,
ex.message.each_line.map { [" " * INDENTBY, _1] }.join,
"\n\n",
" ", Paint[" Backtrace ", :white, :blue, :bold], "\n",
format_backtrace(ex.backtrace), "\n",
@ -22,8 +22,8 @@ module Twenty::Command::Hook
private
def format_backtrace(backtrace)
backtrace[0..FRAME_MAX - 1].map do
[" " * INDENT_BY, _1.gsub(Dir.getwd, "")].join
backtrace[0..FRAMEMAX - 1].map do
[" " * INDENTBY, _1.gsub(Dir.getwd, "")].join
end.join("\n")
end
end