diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache index be5e26dcd66..8327a3492fa 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache @@ -13,7 +13,7 @@ end unless response.success? - if response.status == 0 + if response.status == 0 && response.respond_to?(:return_message) # Errors from libcurl will be made visible here fail ApiError.new(code: 0, message: response.return_message) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb index 5a52719c53b..8f0d3598b45 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api_client.rb @@ -58,7 +58,7 @@ module Petstore end unless response.success? - if response.status == 0 + if response.status == 0 && response.respond_to?(:return_message) # Errors from libcurl will be made visible here fail ApiError.new(code: 0, message: response.return_message)