Exception: Autobuild::PhaseException

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/autobuild/exceptions.rb

Overview

Base class for all Autobuild exceptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target = nil, phase = nil, options = Hash.new) ⇒ PhaseException

Creates a new exception which occured while doing phase in target



22
23
24
25
26
27
28
# File 'lib/autobuild/exceptions.rb', line 22

def initialize(target = nil, phase = nil, options = Hash.new)
    options = Kernel.validate_options options, retry: true
    @target = target
    @phase  = phase
    @retry  = options[:retry]
    super()
end

Instance Attribute Details

#phaseObject

Returns the value of attribute phase.



18
19
20
# File 'lib/autobuild/exceptions.rb', line 18

def phase
  @phase
end

#targetObject

Returns the value of attribute target.



18
19
20
# File 'lib/autobuild/exceptions.rb', line 18

def target
  @target
end

Instance Method Details

#exception_messageObject



30
# File 'lib/autobuild/exceptions.rb', line 30

alias exception_message to_s

#fatal?Boolean

If the error is fatal

Returns:

  • (Boolean)


10
11
12
# File 'lib/autobuild/exceptions.rb', line 10

def fatal?
    true
end

#mail?Boolean

If the error should be reported by mail

Returns:

  • (Boolean)


5
6
7
# File 'lib/autobuild/exceptions.rb', line 5

def mail?
    false
end

#retry?Boolean

If the error can be retried

Returns:

  • (Boolean)


15
16
17
# File 'lib/autobuild/exceptions.rb', line 15

def retry?
    @retry
end

#to_sObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/autobuild/exceptions.rb', line 31

def to_s
    dir = "(#{target.srcdir})" if target.respond_to?(:srcdir)
    target_name =
        if target.respond_to?(:name)
            target.name
        else
            target.to_str
        end

    if target && phase
        "#{target_name}#{dir}: failed in #{phase} phase\n    #{super}"
    elsif target
        "#{target_name}#{dir}: #{super}"
    else
        super
    end
end