diff --git a/modules/openapi-generator/src/main/resources/crystal/api_error.mustache b/modules/openapi-generator/src/main/resources/crystal/api_error.mustache index 1a00af1b1160..52678bd87821 100644 --- a/modules/openapi-generator/src/main/resources/crystal/api_error.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/api_error.mustache @@ -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.try &.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}" diff --git a/samples/client/petstore/crystal/src/petstore/api_error.cr b/samples/client/petstore/crystal/src/petstore/api_error.cr index 0f65b5403847..73a53433dec0 100644 --- a/samples/client/petstore/crystal/src/petstore/api_error.cr +++ b/samples/client/petstore/crystal/src/petstore/api_error.cr @@ -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.try &.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}"