2 * This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at https://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
8 package wtf
.metio
.yosql
.dao
.jdbc
;
10 import com
.squareup
.javapoet
.ClassName
;
11 import com
.squareup
.javapoet
.TypeName
;
12 import wtf
.metio
.yosql
.codegen
.api
.MethodExceptionHandler
;
13 import wtf
.metio
.yosql
.models
.immutables
.SqlConfiguration
;
15 import java
.sql
.SQLException
;
16 import java
.util
.Collections
;
18 public final class JdbcMethodExceptionHandler
implements MethodExceptionHandler
{
21 public Iterable
<?
extends TypeName
> thrownExceptions(final SqlConfiguration configuration
) {
22 return configuration
.catchAndRethrow()
23 .filter(Boolean
.TRUE
::equals
)
24 .map(bool
-> Collections
.<TypeName
>emptyList())
25 .orElseGet(() -> Collections
.singletonList(ClassName
.get(SQLException
.class)));