Class: CemAcpt::Bolt::Cmd::OutputError

Inherits:
Object
  • Object
show all
Defined in:
lib/cem_acpt/bolt/cmd/output.rb

Overview

Represents a Bolt error value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_hash) ⇒ OutputError

Returns a new instance of OutputError.



266
267
268
269
270
271
272
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 266

def initialize(error_hash)
  @error_hash = error_hash
  @kind = error_hash['kind']
  @issue_code = error_hash['issue_code'] || 'OTHER_ERROR'
  @msg = error_hash['msg']
  @details = error_hash['details']
end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



264
265
266
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 264

def details
  @details
end

#issue_codeObject

Returns the value of attribute issue_code.



264
265
266
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 264

def issue_code
  @issue_code
end

#kindObject

Returns the value of attribute kind.



264
265
266
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 264

def kind
  @kind
end

#msgObject

Returns the value of attribute msg.



264
265
266
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 264

def msg
  @msg
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



306
307
308
309
310
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 306

def ==(other)
  return false unless other.is_a?(self.class)

  to_h == other.to_h
end

#backtraceObject



290
291
292
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 290

def backtrace
  details['backtrace'] || []
end

#error?Boolean

Returns:

  • (Boolean)


274
275
276
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 274

def error?
  true
end

#exit_codeObject



286
287
288
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 286

def exit_code
  details['exit_code'] || 1
end

#inspectObject



298
299
300
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 298

def inspect
  "#<#{self.class.name}(#{self.class.object_id})#{self}>"
end

#statusObject



282
283
284
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 282

def status
  'failure'
end

#success?Boolean

Returns:

  • (Boolean)


278
279
280
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 278

def success?
  false
end

#to_hObject



302
303
304
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 302

def to_h
  @error_hash
end

#to_sObject



294
295
296
# File 'lib/cem_acpt/bolt/cmd/output.rb', line 294

def to_s
  "issue code: #{issue_code}, kind: #{kind}, message: #{msg}"
end