Hi,
Assuming you are referring to codegen 2.x version (latest version is 2.4.0), and to "spring" server generator, atm generated operation methods in interface and/or controller don't throw Exception.
There are ongoing efforts and tickets (e.g. https://github.com/swagger-api/swagger-codegen/issues/8755) to allow to add such behaviour as an option (and any help in this or other areas is welcome..), but with current version that is not possible.
The best way to achieve what you mention with current version is probably using custom templates (see https://github.com/swagger-api/swagger-codegen#modifying-the-client-library-format), adding the `throw Exception` to the custom template, and passing the `templateDirectory` parameter (https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen-maven-plugin/README.md#general-configuration-parameters).
In this case, you would copy the related template dir (https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/JavaSpring) to a dir of your choice (then referenced in parameter), and modify needed files (in this case `api.mustache` and `apiController.mustache`)
E.g.
api.mustache line 103
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) throws Exception{{^jdk8}};{{/jdk8}}{{#jdk8}} {