mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
[crystal-lang] Resolve type check compile error in ApiError (#18759)
* Even with .nil? typecheck, compiler still fails due to .empty? call on nillable type. This appears a poor implementation issue by crystal-lang, but this explicit try avoids the issue for now. * Made call more succinct.
This commit is contained in:
@@ -21,7 +21,7 @@ module {{moduleName}}
|
||||
msg = ""
|
||||
msg = msg + "\nHTTP status code: #{code}" if @code
|
||||
msg = msg + "\nResponse headers: #{response_headers}" if @response_headers
|
||||
if @message.nil? || @message.empty?
|
||||
if @message.try &.empty?
|
||||
msg = msg + "\nError message: the server returns an error but the HTTP response body is empty."
|
||||
else
|
||||
msg = msg + "\nResponse body: #{@message}"
|
||||
|
||||
@@ -29,7 +29,7 @@ module Petstore
|
||||
msg = ""
|
||||
msg = msg + "\nHTTP status code: #{code}" if @code
|
||||
msg = msg + "\nResponse headers: #{response_headers}" if @response_headers
|
||||
if @message.nil? || @message.empty?
|
||||
if @message.try &.empty?
|
||||
msg = msg + "\nError message: the server returns an error but the HTTP response body is empty."
|
||||
else
|
||||
msg = msg + "\nResponse body: #{@message}"
|
||||
|
||||
Reference in New Issue
Block a user