Class: OpenWFE::ProcessError

Inherits:
Object
  • Object
show all
Defined in:
lib/openwfe/expool/errorjournal.rb

Overview

Encapsulating process error information.

Instances of this class may be used to replay_at_error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ProcessError



89
90
91
92
93
# File 'lib/openwfe/expool/errorjournal.rb', line 89

def initialize (*args)

    @date = Time.new
    @fei, @message, @workitem, @error_class, @stacktrace = args
end

Instance Attribute Details

#dateObject (readonly)

When did the error occur.



60
61
62
# File 'lib/openwfe/expool/errorjournal.rb', line 60

def date
  @date
end

#error_classObject (readonly)

The error class (String) of the top level error



87
88
89
# File 'lib/openwfe/expool/errorjournal.rb', line 87

def error_class
  @error_class
end

#feiObject (readonly)

The FlowExpressionId instance uniquely pointing at the expression which ‘failed’.



66
67
68
# File 'lib/openwfe/expool/errorjournal.rb', line 66

def fei
  @fei
end

#messageObject (readonly)

Generally something like :apply or :reply



71
72
73
# File 'lib/openwfe/expool/errorjournal.rb', line 71

def message
  @message
end

#stacktraceObject (readonly)

The String stack trace of the error.



82
83
84
# File 'lib/openwfe/expool/errorjournal.rb', line 82

def stacktrace
  @stacktrace
end

#workitemObject (readonly)

The workitem accompanying the message (apply(workitem) / reply (workitem)).



77
78
79
# File 'lib/openwfe/expool/errorjournal.rb', line 77

def workitem
  @workitem
end

Instance Method Details

#==(other) ⇒ Object

Returns true if the other instance is a ProcessError and is the same error as this one.



134
135
136
137
138
139
# File 'lib/openwfe/expool/errorjournal.rb', line 134

def == (other)
    return false unless other.is_a?(ProcessError)
    return to_s == other.to_s
        #
        # a bit costly but as it's only used by resume_process()...
end

#hashObject

Returns a hash



124
125
126
127
128
# File 'lib/openwfe/expool/errorjournal.rb', line 124

def hash
    to_s.hash
        #
        # a bit costly but as it's only used by resume_process()...
end

#to_sObject

Produces a human readable version of the information in the ProcessError instance.



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/openwfe/expool/errorjournal.rb', line 109

def to_s
    s = ""
    s << "-- #{self.class.name} --\n"
    s << "     date :        #{@date}\n"
    s << "     fei :         #{@fei}\n"
    s << "     message :     #{@message}\n"
    s << "     workitem :    ...\n"
    s << "     error_class : #{@error_class}\n"
    s << "     stacktrace :  #{@stacktrace[0, 80]}\n"
    s
end

#wfidObject Also known as: parent_wfid

Returns the parent workflow instance id (process id) of this ProcessError instance.



99
100
101
# File 'lib/openwfe/expool/errorjournal.rb', line 99

def wfid
    @fei.parent_wfid
end