lib/exceptions.rb in markdown_exec-1.8.7 vs lib/exceptions.rb in markdown_exec-1.8.8
- old
+ new
@@ -2,15 +2,17 @@
# frozen_string_literal: true
# encoding=utf-8
module Exceptions
- def self.error_handler(name = '', opts = {}, format_string: "\nError: %{name} -- %{message}", color_symbol: :red, take_count: 16)
+ def self.error_handler(name = '', opts = {}, backtrace: $@, format_string: "\nError: %{name} -- %{message}", color_symbol: :red, take_count: 16)
warn(error = format(format_string,
{ name: name, message: $! }).send(color_symbol))
- warn($@.select do |s|
- s.include? 'markdown_exec'
- end.reject { |s| s.include? 'vendor' }.take(take_count).map.with_index { |line, ind| " * #{ind}: #{line}" })
+ if backtrace
+ warn(backtrace.select do |s|
+ s.include? 'markdown_exec'
+ end.reject { |s| s.include? 'vendor' }.take(take_count).map.with_index { |line, ind| " * #{ind}: #{line}" })
+ end
binding.pry if $tap_enable
raise ArgumentError, error unless opts.fetch(:abort, true)
exit 1