Exception: Braid::Operations::ShellExecutionError

Inherits:
BraidError
  • Object
show all
Defined in:
lib/braid/operations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from T::Sig

#sig

Constructor Details

#initialize(err = nil, out = nil) ⇒ ShellExecutionError

Returns a new instance of ShellExecutionError.



18
19
20
21
# File 'lib/braid/operations.rb', line 18

def initialize(err = nil, out = nil)
  @err = err
  @out = out
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



15
16
17
# File 'lib/braid/operations.rb', line 15

def err
  @err
end

#outObject (readonly)

Returns the value of attribute out.



15
16
17
# File 'lib/braid/operations.rb', line 15

def out
  @out
end

Instance Method Details

#messageObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/braid/operations.rb', line 24

def message
  first_line = @err.to_s.split("\n").first
  # Currently, first_line can be nil if @err was empty, but Sorbet thinks
  # that the `message` method of an Exception should always return non-nil
  # (although override checking isn't enforced as of this writing), so
  # handle nil here.  This seems ad-hoc but better than putting in a
  # `T.must` that we know has a risk of being wrong.  Hopefully this will
  # be fixed better in https://github.com/cristibalan/braid/issues/90.
  first_line.nil? ? '' : first_line
end