Skip to content

Commit beecec3

Browse files
Kirill Vecherakvechera
Kirill Vechera
authored andcommitted
Operation errors should always be ErrorHash
fixed hyperstack-org#101 when ServerOp transmits errors to the client
1 parent c0f18b0 commit beecec3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ruby/hyper-operation/lib/hyper-operation/exception.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module Mutations
2-
class ErrorArray
2+
class ErrorHash
33
def self.new_from_error_hash(errors)
4-
new(errors.collect do |key, values|
5-
ErrorAtom.new(key, values[:symbol], values)
6-
end)
4+
new.tap do |hash|
5+
errors.each do |key, values|
6+
hash[key] = ErrorAtom.new(key, values[:symbol], values)
7+
end
8+
end
79
end
810
end
911
end
@@ -30,7 +32,7 @@ def as_json(*)
3032

3133
def initialize(errors)
3234
unless errors.is_a? Mutations::ErrorHash
33-
errors = Mutations::ErrorArray.new_from_error_hash(errors)
35+
errors = Mutations::ErrorHash.new_from_error_hash(errors)
3436
end
3537
super(errors)
3638
end

0 commit comments

Comments
 (0)