
javaVertXServer.AsyncCall.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-swagger-codegen Show documentation
Show all versions of vertx-swagger-codegen Show documentation
A Swagger codegen plugin for Vert.X. Based on the Swagger Router.
service.{{operationId}}({{#hasParams}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}, {{/hasMore}}{{/allParams}}{{/hasParams}}result -> {
if (result.succeeded())
{{#returnType}}
{{#isListContainer}}
message.reply(new JsonArray(Json.encode(result.result())).encodePrettily());
{{/isListContainer}}
{{^isListContainer}}
message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
{{/isListContainer}}
{{/returnType}}
{{^returnType}}
message.reply(null);
{{/returnType}}
else {
Throwable cause = result.cause();
int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode();
String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage();
if (cause instanceof MainApiException) {
code = ((MainApiException)cause).getStatusCode();
statusMessage = ((MainApiException)cause).getStatusMessage();
} else {
LOGGER.error("Unexpected error in "+{{#vendorExtensions}}{{x-serviceId-varName}}{{/vendorExtensions}}, cause);
}
message.fail(code, statusMessage);
}
});
© 2015 - 2025 Weber Informatics LLC | Privacy Policy