forked from loafle/openapi-generator-original
[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:
parent
e6fcbcbde0
commit
77365c34fa
@ -21,7 +21,7 @@ module {{moduleName}}
|
|||||||
msg = ""
|
msg = ""
|
||||||
msg = msg + "\nHTTP status code: #{code}" if @code
|
msg = msg + "\nHTTP status code: #{code}" if @code
|
||||||
msg = msg + "\nResponse headers: #{response_headers}" if @response_headers
|
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."
|
msg = msg + "\nError message: the server returns an error but the HTTP response body is empty."
|
||||||
else
|
else
|
||||||
msg = msg + "\nResponse body: #{@message}"
|
msg = msg + "\nResponse body: #{@message}"
|
||||||
|
@ -29,7 +29,7 @@ module Petstore
|
|||||||
msg = ""
|
msg = ""
|
||||||
msg = msg + "\nHTTP status code: #{code}" if @code
|
msg = msg + "\nHTTP status code: #{code}" if @code
|
||||||
msg = msg + "\nResponse headers: #{response_headers}" if @response_headers
|
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."
|
msg = msg + "\nError message: the server returns an error but the HTTP response body is empty."
|
||||||
else
|
else
|
||||||
msg = msg + "\nResponse body: #{@message}"
|
msg = msg + "\nResponse body: #{@message}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user