Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation errors should always be ErrorHash #304

Open
wants to merge 1 commit into
base: edge
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions ruby/hyper-operation/lib/hyper-operation/exception.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module Mutations
class ErrorArray
class ErrorHash
def self.new_from_error_hash(errors)
new(errors.collect do |key, values|
ErrorAtom.new(key, values[:symbol], values)
end)
new.tap do |hash|
errors.each do |key, values|
hash[key] = ErrorAtom.new(key, values[:symbol], values)
end
end
end
end
end
Expand All @@ -30,7 +32,7 @@ def as_json(*)

def initialize(errors)
unless errors.is_a? Mutations::ErrorHash
errors = Mutations::ErrorArray.new_from_error_hash(errors)
errors = Mutations::ErrorHash.new_from_error_hash(errors)
end
super(errors)
end
Expand Down