1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Merge pull request #1186 from townsen/clean_trace

Remove unnecessary entries from default backtrace
This commit is contained in:
Lee Hambley 2014-11-17 10:35:53 +01:00
commit 828f81187a
3 changed files with 28 additions and 1 deletions

View file

@ -6,6 +6,21 @@ Reverse Chronological Order:
https://github.com/capistrano/capistrano/compare/v3.2.1...HEAD
* Enhancement (@townsen): Remove unnecessary entries from default backtrace
When the `--backtrace` (or `--trace`) command line option is not supplied
Rake lowers the noise level in exception backtraces by building
a regular expression containing all the system library paths and
using it to exclude backtrace entries that match.
This does not always go far enough, particularly in RVM environments when
many gem paths are added. This commit reverses that approach and _only_
include backtrace entries that fall within the Capfile and list of tasks
imported thereafter. This makes reading exceptions much easier on the eye.
If the full unexpurgated backtrace is required then the --backtrace
and --trace options supply it as before.
* Disable loading stages configs on `cap -T`
* Enhancements (@townsen)
* Fix matching on hosts with custom ports or users set

View file

@ -61,6 +61,18 @@ module Capistrano
end
end
def display_error_message(ex)
unless options.backtrace
if loc = Rake.application.find_rakefile_location
whitelist = (@imported.dup << loc[0]).map{|f| File.absolute_path(f, loc[1])}
pattern = %r@^(?!#{whitelist.map{|p| Regexp.quote(p)}.join('|')})@
Rake.application.options.suppress_backtrace_pattern = pattern
end
trace "(Backtrace restricted to imported tasks)"
end
super
end
def exit_because_of_exception(ex)
if respond_to?(:deploying?) && deploying?
exit_deploy_because_of_exception(ex)

View file

@ -53,7 +53,7 @@ module Capistrano
end
def exit_deploy_because_of_exception(ex)
warn t(:deploy_failed, ex: ex.inspect)
warn t(:deploy_failed, ex: ex.message)
invoke 'deploy:failed'
exit(false)
end