Class: Dynflow::ExecutionPlan::Steps::Error
- Inherits:
 - 
      Serializable
      
        
- Object
 - Serializable
 - Dynflow::ExecutionPlan::Steps::Error
 
 
- Extended by:
 - Algebrick::Matching
 
- Includes:
 - Algebrick::TypeCheck
 
- Defined in:
 - lib/dynflow/execution_plan/steps/error.rb
 
Constant Summary
Constants inherited from Serializable
Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT
Instance Attribute Summary collapse
- 
  
    
      #backtrace  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute backtrace.
 - 
  
    
      #exception_class  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute exception_class.
 - 
  
    
      #message  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute message.
 
Class Method Summary collapse
Instance Method Summary collapse
- #exception ⇒ Object
 - 
  
    
      #initialize(exception_class, message, backtrace, exception)  ⇒ Error 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Error.
 - #to_hash ⇒ Object
 - #to_s ⇒ Object
 
Methods inherited from Serializable
Constructor Details
#initialize(exception_class, message, backtrace, exception) ⇒ Error
Returns a new instance of Error.
      28 29 30 31 32 33  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 28 def initialize(exception_class, , backtrace, exception) @exception_class = Child! exception_class, Exception @message = Type! , String @backtrace = Type! backtrace, Array @exception = Type! exception, Exception, NilClass end  | 
  
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
      9 10 11  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 9 def backtrace @backtrace end  | 
  
#exception_class ⇒ Object (readonly)
Returns the value of attribute exception_class.
      9 10 11  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 9 def exception_class @exception_class end  | 
  
#message ⇒ Object (readonly)
Returns the value of attribute message.
      9 10 11  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 9 def @message end  | 
  
Class Method Details
.new(*args) ⇒ Object
      11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 11 def self.new(*args) case args.size when 1 match obj = args.first, (on String do super(StandardError, obj, caller, nil) end), (on Exception do super(obj.class, obj., obj.backtrace, obj) end) when 3, 4 super(*args.values_at(0..3)) else raise ArgumentError, "wrong number of arguments #{args}" end end  | 
  
.new_from_hash(hash) ⇒ Object
      35 36 37 38 39 40 41 42  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 35 def self.new_from_hash(hash) exception_class = begin Utils.constantize(hash[:exception_class]) rescue NameError Errors::UnknownError.for_exception_class(hash[:exception_class]) end self.new(exception_class, hash[:message], hash[:backtrace], nil) end  | 
  
Instance Method Details
#exception ⇒ Object
      58 59 60 61  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 58 def exception @exception || exception_class.exception().tap { |e| e.set_backtrace backtrace } end  | 
  
#to_hash ⇒ Object
      44 45 46 47 48 49  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 44 def to_hash recursive_to_hash class: self.class.name, exception_class: exception_class.to_s, message: , backtrace: backtrace end  | 
  
#to_s ⇒ Object
      51 52 53 54 55 56  | 
    
      # File 'lib/dynflow/execution_plan/steps/error.rb', line 51 def to_s format '%s (%s)\n%s', (@exception || self)., (@exception ? @exception.class : exception_class), (@exception || self).backtrace end  |