[BUG][RUBY] Faraday::ConnectionFailed not handled
Created by: jethrodaniel
Description
The Ruby client, when built with the faraday
library
option, currently doesn't handle Faraday::ConnectionFailed
issues (i.e, server is down).
openapi-generator version
openapitools/openapi-generator-cli:v6.2.0
Generation Details
Relevant portion of openapi-generator-config.yaml
:
library: faraday
gemRequiredRubyVersion: '>= 2.7'
Suggest a fix
Fix is simple, just rescue Faraday::ConnectionFailed
here: https://github.com/OpenAPITools/openapi-generator/blob/24f476a38161a797c773577cab775ef285baeaba/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache#L27-L29
i.e,
rescue Faraday::TimeoutError
fail ApiError.new('Connection timed out')
rescue Faraday::ConnectionFailed
fail ApiError.new('Connection failed')
end