Exception: Flor::Caller::SpawnError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/flor/unit/caller.rb

Direct Known Subclasses

SpawnNonZeroExitError, WrappedSpawnError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conf, ctx, msg) ⇒ SpawnError

Returns a new instance of SpawnError.



244
245
246
247
248
249
250
# File 'lib/flor/unit/caller.rb', line 244

def initialize(conf, ctx, msg)

  @conf = conf
  @ctx = ctx

  super(msg)
end

Instance Attribute Details

#confObject

Returns the value of attribute conf.



242
243
244
# File 'lib/flor/unit/caller.rb', line 242

def conf
  @conf
end

#ctxObject

Returns the value of attribute ctx.



242
243
244
# File 'lib/flor/unit/caller.rb', line 242

def ctx
  @ctx
end

Instance Method Details

#detailsObject



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/flor/unit/caller.rb', line 252

def details

  ha = Flor.yes?(@conf['on_error_hide_all'])
  hcd = Flor.yes?(@conf['on_error_hide_cmd'])
  hcf = Flor.yes?(@conf['on_error_hide_conf'])

  cd = (ha || hcd) ? '(hidden)' : @conf['cmd']
  cf = (ha || hcf) ? '(hidden)' : @conf.dup
  cf['cmd'] = '(hidden)' if hcd && cf.is_a?(Hash)

  d = {
    cmd: cd, conf: cf,
    timeout: ctx[:to],
    pid: ctx[:pid],
    start: Flor.tstamp(ctx[:t0]),
    duration: Fugit.parse(Time.now - ctx[:t0]).to_plain_s,
    cause: cause }

  add_details(d) \
    if respond_to?(:add_details)

  d
end