Skip to content

Commit

Permalink
Merge 04cbb71 into fef945f
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed May 14, 2019
2 parents fef945f + 04cbb71 commit 51c502a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/scorpio/openapi/operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ def http_method
end
end

# @return [String] a short identifier for this operation appropriate for an error message
def human_id
operationId || "path: #{path_template_str}, method: #{http_method}"
end

# this method is not intended to be API-stable at the moment.
#
# @return [#to_ary<#to_h>] the parameters specified for this operation, plus any others
Expand Down
4 changes: 2 additions & 2 deletions lib/scorpio/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ def path
path_params = JSI.stringify_symbol_keys(self.path_params)
missing_variables = path_template.variables - path_params.keys
if missing_variables.any?
raise(ArgumentError, "path #{operation.path_template_str} for operation #{operation.operationId} requires path_params " +
raise(ArgumentError, "path #{operation.path_template_str} for operation #{operation.human_id} requires path_params " +
"which were missing: #{missing_variables.inspect}")
end
empty_variables = path_template.variables.select { |v| path_params[v].to_s.empty? }
if empty_variables.any?
raise(ArgumentError, "path #{operation.path_template_str} for operation #{operation.operationId} requires path_params " +
raise(ArgumentError, "path #{operation.path_template_str} for operation #{operation.human_id} requires path_params " +
"which were empty: #{empty_variables.inspect}")
end

Expand Down
2 changes: 1 addition & 1 deletion lib/scorpio/ur.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def raise_on_http_error
HTTPError
end
if error_class
message = "Error calling operation #{scorpio_request.operation.operationId}:\n" + response.body
message = "Error calling operation #{scorpio_request.operation.human_id}:\n" + response.body
raise(error_class.new(message).tap do |e|
e.ur = self
e.response_object = response.body_object
Expand Down

0 comments on commit 51c502a

Please sign in to comment.