Skip to content

Commit

Permalink
Ensure UserError is raised with a reason value
Browse files Browse the repository at this point in the history
This commit addresses the issue fixed in
416cf28; however that commit
discarded the reason attached to the exception.  This should be kept,
since Train::UserError covers a lot of ground and the reason
code can help clients differentiate cause without resorting to
their own parsing of error string.

Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
  • Loading branch information
marcparadise committed Aug 28, 2019
1 parent 1bee35f commit 50a8724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/train/extras/command_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def self.load(transport, options)
res = LinuxCommand.new(transport, options)
verification_res = res.verify
if verification_res
msg, _reason = verification_res
raise Train::UserError, "Sudo failed: #{msg}"
msg, reason = verification_res
raise Train::UserError.new("Sudo failed: #{msg}", reason)
end
res
elsif transport.platform.windows?
Expand Down

0 comments on commit 50a8724

Please sign in to comment.