Skip to content

Commit

Permalink
Raise error when trying to save a null object
Browse files Browse the repository at this point in the history
Raise error when trying to save a null object through GraphQL update mutation.

Reference: CV2-3826.
  • Loading branch information
caiosba authored Oct 9, 2023
1 parent d961a34 commit c92ecc7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/graph/mutations/graphql_crud_operations.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class GraphqlCrudOperations
def self.safe_save(obj, attrs, parent_names = [])
raise "Can't save a null object." if obj.nil?
raise 'This operation must be done by a signed-in user' if User.current.nil? && ApiKey.current.nil?
attrs.each do |key, value|
method = key == "clientMutationId" ? "client_mutation_id=" : "#{key}="
Expand Down

0 comments on commit c92ecc7

Please sign in to comment.