Skip to content

Instantly share code, notes, and snippets.

@jaydorsey
Created October 25, 2019 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaydorsey/17ef9cee2a31f902c7229099b3dc2d06 to your computer and use it in GitHub Desktop.
Save jaydorsey/17ef9cee2a31f902c7229099b3dc2d06 to your computer and use it in GitHub Desktop.
# This file lives in the pry gem. This patch strips out backtrace information from the gems, so I
# only see _my_ code files related to an error when I'm in a pry session
#
# Replace the content in the begin block inside the +show_result+ method
#
# @todo Make this a separate gem that I can install to patch this method without having to edit my
# bundled pry gem
relevant_context = e.backtrace.reject { |b| b =~ /(ruby\/gem)|(asdf\/installs)/ }
output.puts "(pry) output error: #{e.inspect}\n\nRelevant files:\n\n#{relevant_context.join("\n")}\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment