Exception: DTK::ErrorNotFound

Inherits:
Error
  • Object
show all
Defined in:
lib/errors/errors.rb

Constant Summary

Constants inherited from Error

DTK::Error::CallerOffset, DTK::Error::DefaultCallerDepth

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Error

top_error_in_hash

Constructor Details

#initialize(obj_type = nil, obj_value = nil) ⇒ ErrorNotFound

Returns a new instance of ErrorNotFound.



105
106
107
108
# File 'lib/errors/errors.rb', line 105

def initialize(obj_type=nil,obj_value=nil)
  @obj_type = obj_type
  @obj_value = obj_value
end

Instance Attribute Details

#obj_typeObject (readonly)

Returns the value of attribute obj_type.



104
105
106
# File 'lib/errors/errors.rb', line 104

def obj_type
  @obj_type
end

#obj_valueObject (readonly)

Returns the value of attribute obj_value.



104
105
106
# File 'lib/errors/errors.rb', line 104

def obj_value
  @obj_value
end

Instance Method Details

#to_hashObject



118
119
120
121
122
123
124
125
126
# File 'lib/errors/errors.rb', line 118

def to_hash()
  if obj_type.nil?
     {:error => :NotFound}
  elsif obj_value.nil?
    {:error => {:NotFound => {:type => @obj_type}}}
  else
    {:error => {:NotFound => {:type => @obj_type, :value => @obj_value}}}
  end
end

#to_sObject



109
110
111
112
113
114
115
116
117
# File 'lib/errors/errors.rb', line 109

def to_s()
  if obj_type.nil?
    "NotFound error:" 
  elsif obj_value.nil?
    "NotFound error: type = #{@obj_type.to_s}"
  else
    "NotFound error: #{@obj_type.to_s} = #{@obj_value.to_s}"
  end
end