Skip to content

Commit a258cf3

Browse files
davidvanlaatumwing328
authored andcommitted
#714 prevent throwing another exception if the request fails eg connection reset (#715)
* prevent throwing another exception if the request fails eg connection reset * prevent throwing another exception if the request fails eg connection reset
1 parent 07a5715 commit a258cf3

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ module {{moduleName}}
238238
tempfile.write(chunk)
239239
end
240240
request.on_complete do |response|
241-
tempfile.close
241+
tempfile.close if tempfile
242242
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
243243
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
244244
"will be deleted automatically with GC. It's also recommended to delete the temp file "\

samples/client/petstore/ruby/lib/petstore/api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def download_file(request)
244244
tempfile.write(chunk)
245245
end
246246
request.on_complete do |response|
247-
tempfile.close
247+
tempfile.close if tempfile
248248
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
249249
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
250250
"will be deleted automatically with GC. It's also recommended to delete the temp file "\

0 commit comments

Comments
 (0)