@@ -40,10 +40,6 @@ class UploadJob < ApplicationJob
40
40
def perform ( payload )
41
41
modified_locales ( payload ) . each do |locale |
42
42
projects_data = load_projects_data ( locale , repository ( payload ) , owner ( payload ) )
43
- if projects_data . data . repository &.object . nil?
44
- Rails . logger . warn 'Build skipped, does the repo exist?'
45
- break
46
- end
47
43
48
44
projects_data . data . repository . object . entries . each do |project_dir |
49
45
project = format_project ( project_dir , locale , repository ( payload ) , owner ( payload ) )
@@ -80,28 +76,10 @@ def load_projects_data(locale, repository, owner)
80
76
end
81
77
82
78
def handle_graphql_errors ( response )
83
- errors = response &.errors . presence || response &.data &.errors
79
+ errors = response &.errors || response &.data &.errors
84
80
return if errors . blank?
85
81
86
- error_messages , error_details , error_type = extract_error_info ( errors )
87
-
88
- # Handle NOT_FOUND errors as a special case, as this can happen when the repo is first created
89
- raise GraphQL ::Client ::Error , "GraphQL query failed with errors: #{ error_messages } . Details: #{ error_details } " unless error_type == 'NOT_FOUND'
90
- end
91
-
92
- def extract_error_info ( errors )
93
- error_type = nil
94
- if errors . is_a? ( Array ) && errors . first . is_a? ( Hash )
95
- # Query level error
96
- error_messages = errors . map { |error | error }
97
- error_details = errors . map { |error | error }
98
- error_type = error_details . dig ( 0 , 1 , 0 , 'type' )
99
- else
100
- # Top level error
101
- error_messages = errors . messages [ 'data' ] . first
102
- error_details = errors . details [ 'data' ] . first [ 'message' ]
103
- end
104
- [ error_messages , error_details , error_type ]
82
+ raise GraphQL ::Client ::Error , "GraphQL query failed with errors: #{ errors . inspect } "
105
83
end
106
84
107
85
def format_project ( project_dir , locale , repository , owner )
0 commit comments