Exception: CuvvaError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cuvva_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CuvvaError

Returns a new instance of CuvvaError.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cuvva_error.rb', line 9

def initialize(*args)
	code, reasons, meta = args

	if meta === nil && !reasons.is_a?(Array)
		meta = reasons
		reasons = nil
	end

	@code = code
	@reasons = reasons
	@meta = meta
	@stack = caller
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/cuvva_error.rb', line 4

def code
  @code
end

#metaObject

Returns the value of attribute meta.



6
7
8
# File 'lib/cuvva_error.rb', line 6

def meta
  @meta
end

#reasonsObject

Returns the value of attribute reasons.



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

def reasons
  @reasons
end

#stackObject (readonly)

Returns the value of attribute stack.



7
8
9
# File 'lib/cuvva_error.rb', line 7

def stack
  @stack
end

Instance Method Details

#to_hashObject



23
24
25
26
27
28
29
# File 'lib/cuvva_error.rb', line 23

def to_hash
	{
		code: self.code,
		reasons: self.reasons,
		meta: self.meta,
	}
end

#to_json(*args) ⇒ Object



31
32
33
# File 'lib/cuvva_error.rb', line 31

def to_json(*args)
	to_hash.to_json(*args)
end