Throw Exception from controller methods

This commit is contained in:
stevecookform3 2017-05-31 09:46:51 +01:00
parent 15a0bf5df5
commit 0f3f0686cc
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ public interface {{classname}} {
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}}
method = RequestMethod.{{httpMethod}})
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} {
{{/hasMore}}{{/allParams}}){{^jdk8}} throws Exception;{{/jdk8}}{{#jdk8}} {
// do some magic!
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
}{{/jdk8}}

View File

@ -29,7 +29,7 @@ import java.util.concurrent.Callable;
public class {{classname}}Controller implements {{classname}} {
{{^jdk8}}{{#operation}}
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},
{{/hasMore}}{{/allParams}}) {
{{/hasMore}}{{/allParams}}) throws Exception {
// do some magic!{{^async}}
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);{{/async}}{{#async}}
return new Callable<ResponseEntity<{{>returnTypes}}>>() {