Exception: Krill::KrillBaseError + + + +
+-
+
- Inherits: +
-
+ StandardError
+
+
-
+
- Object + +
- StandardError + +
- Krill::KrillBaseError + +
+
-
+
- Defined in: +
- lib/krill/protocol_sandbox.rb +
Direct Known Subclasses
+ +Instance Attribute Summary collapse
+-
+
+
- + + + #error ⇒ Object + + + + + + + + + readonly + + + + + + + + + + + + + + +
- + + + #namespace ⇒ Object + + + + + + + + + readonly + + + + + + + + + + + + + + +
- + + + #operation_type ⇒ Object + + + + + + + + + readonly + + + + + + + + + + + + + + +
+ Instance Method Summary + collapse +
+ +-
+
+
-
+
+
+ #error_backtrace ⇒ Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
Returns the backtrace of the associated error filtered to exclude Aquarium context.
+
+
+
+ -
+
+
+ #error_message ⇒ Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
Returns a transformed version of the message for the error of this object.
+
+
+
+ -
+
+
+ #initialize(operation_type:, error:, message:, namespace: '') ⇒ KrillBaseError
+
+
+
+
+
+
+ constructor
+
+
+
+
+
+
+
+
+ + +
Create a KrillBaseError object for the given operation type, error and message.
+
+
+
+ -
+
+
+ #operation_path ⇒ Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
Returns the path of the operation type for this error.
+
+
+
+
Constructor Details
+ ++ + #initialize(operation_type:, error:, message:, namespace: '') ⇒ KrillBaseError + + + + + +
Create a KrillBaseError object for the given operation type, error and message.
+ + +
+ + + +151 +152 +153 +154 +155 +156+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 151 + +def initialize(operation_type:, error:, message:, namespace: '') + @operation_type = operation_type + @error = error + @namespace = namespace + super() +end+ |
+
Instance Attribute Details
+ + + ++ + #error ⇒ Object (readonly) + + + + + +
+ + + +144 +145 +146+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 144 + +def error + @error +end+ |
+
+ + #namespace ⇒ Object (readonly) + + + + + +
+ + + +144 +145 +146+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 144 + +def namespace + @namespace +end+ |
+
+ + #operation_type ⇒ Object (readonly) + + + + + +
+ + + +144 +145 +146+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 144 + +def operation_type + @operation_type +end+ |
+
Instance Method Details
+ + ++ + #error_backtrace ⇒ Object + + + + + +
Returns the backtrace of the associated error filtered to exclude +Aquarium context. +Replaces occurrences of '(eval)' path with operation type path.
+ + +
+ + + +196 +197 +198 +199 +200 +201 +202 +203 +204 +205+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 196 + +def error_backtrace + split = error.backtrace.collect { |msg| msg.match(/^([^:]+):(\d+):(.+)$/m).captures } + filtered = split.reject { |c| c.first.match(%r{^(/[^/]+)+$}m) } + filtered.collect do |captures| + path, line_number, = captures + path = operation_path if path == '(eval)' + + "#{path}: line #{line_number}: #{.strip}".strip + end +end+ |
+
+ + #error_message ⇒ Object + + + + + +
Returns a transformed version of the message for the error of this object. +Replaces occurrences of "(eval)" with the operation type path, and +removes suffix referencing ExecutionNamespace enclosing the protocol +during execution.
+ + +
+ + + +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 167 + +def + = [] + @error..each_line do |line| + # replaces occurrence of "(eval)" as file path + match = line.match(/^\(eval\):(\d+):(.+)$/m) + if match + line_number, = match.captures + .append("#{operation_path}: line #{line_number}:#{}") + next + end + + # strips uninformative context from NameError message + namespace_pattern = Regexp.new(" for (\#<)?#{@namespace}:(Module|0x[0-9a-f]+>)$") + match = line.match(namespace_pattern) + if match + loc = match.begin(0) - 1 + .append(line[0..loc]) + next + end + + .append(line) + end + + .join('') +end+ |
+
+ + #operation_path ⇒ Object + + + + + +
Returns the path of the operation type for this error.
+ + +
+ + + +159 +160 +161+ |
+
+ # File 'lib/krill/protocol_sandbox.rb', line 159 + +def operation_path + "#{@operation_type.category}/#{@operation_type.name}" +end+ |
+