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.



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

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.



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

def details
  @details
end

#issue_codeObject

Returns the value of attribute issue_code.



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

def issue_code
  @issue_code
end

#kindObject

Returns the value of attribute kind.



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

def kind
  @kind
end

#msgObject

Returns the value of attribute msg.



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

def msg
  @msg
end

Instance Method Details

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



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

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

  to_h == other.to_h
end

#backtraceObject



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

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

#error?Boolean

Returns:

  • (Boolean)


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

def error?
  true
end

#exit_codeObject



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

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

#inspectObject



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

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

#statusObject



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

def status
  'failure'
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  false
end

#to_hObject



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

def to_h
  @error_hash
end

#to_sObject



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

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