Skip to content

Commit 29a46f2

Browse files
committed
refactor: send now throws a Throwable
1 parent 1b2212a commit 29a46f2

File tree

19 files changed

+42
-44
lines changed

19 files changed

+42
-44
lines changed

jooby-assets/src/main/java/org/jooby/internal/assets/AssetHandlerWithCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public AssetHandlerWithCompiler(final String pattern, final AssetCompiler compil
3636
}
3737

3838
@Override
39-
protected void send(final Request req, final Response rsp, final Asset asset) throws Exception {
39+
protected void send(final Request req, final Response rsp, final Asset asset) throws Throwable {
4040
super.send(req, rsp, compiler.build(asset));
4141
}
4242
}

jooby-assets/src/main/java/org/jooby/internal/assets/LiveCompiler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private void onChange(final Kind<?> kind, final Path path) {
8282
}
8383

8484
@Override
85-
public void handle(final Request req, final Response rsp) throws Exception {
85+
public void handle(final Request req, final Response rsp) throws Throwable {
8686
String path = req.path();
8787
if (path.startsWith("/org/jooby/assets/live")) {
8888
new AssetHandler("/").handle(req, rsp);
@@ -95,7 +95,7 @@ public void handle(final Request req, final Response rsp) throws Exception {
9595
}
9696

9797
private void reportErr(final Request req, final Response rsp, final AssetException ex)
98-
throws Exception {
98+
throws Throwable {
9999
StringBuilder buff = new StringBuilder();
100100
buff.append("<!doctype html>\n" +
101101
"<html lang=\"en\">\n" +

jooby-elasticsearch/src/main/java/org/jooby/internal/elasticsearch/EmbeddedHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public EmbeddedHandler(final String path, final ManagedNode node, final boolean
4343
}
4444

4545
@Override
46-
public void handle(final Request req, final Response rsp) throws Exception {
46+
public void handle(final Request req, final Response rsp) throws Throwable {
4747

4848
EmbeddedHttpRequest restReq = new EmbeddedHttpRequest(path, req);
4949
EmbeddedHttpChannel channel = new EmbeddedHttpChannel(restReq, rsp, detailedErrorsEnabled);

jooby-elasticsearch/src/main/java/org/jooby/internal/elasticsearch/EmbeddedHttpChannel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class EmbeddedHttpChannel extends HttpChannel {
3434

3535
private final CountDownLatch latch = new CountDownLatch(1);
3636

37-
private Exception failure;
37+
private Throwable failure;
3838

3939
public EmbeddedHttpChannel(final RestRequest request, final Response rsp,
4040
final boolean detailedErrorsEnabled) {
@@ -55,15 +55,15 @@ public void sendResponse(final RestResponse response) {
5555
.length(content.length())
5656
.type(response.contentType())
5757
.send(content);
58-
} catch (Exception ex) {
58+
} catch (Throwable ex) {
5959
failure = ex;
6060
} finally {
6161
latch.countDown();
6262
}
6363

6464
}
6565

66-
public void done() throws Exception {
66+
public void done() throws Throwable {
6767
latch.await();
6868

6969
if (failure != null) {

jooby-hbm/src/main/java/org/jooby/internal/hbm/TrxResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void setRollbackOnly() {
6969
rollbackOnly = true;
7070
}
7171

72-
private void trxSend(final Object result) throws Exception {
72+
private void trxSend(final Object result) throws Throwable {
7373

7474
Consumer<Boolean> setReadOnly = (readOnly) -> {
7575
try {
@@ -105,7 +105,7 @@ private void trxSend(final Object result) throws Exception {
105105

106106
log.debug(" [{}] commiting readonly transaction: {}", sessionId, readOnlyTrx);
107107
readOnlyTrx.commit();
108-
} catch (Exception ex) {
108+
} catch (Throwable ex) {
109109
if (readOnlyTrx != null && readOnlyTrx.isActive()) {
110110
log.debug(" [{}] rolling back readonly transaction: {}", sessionId, readOnlyTrx);
111111
readOnlyTrx.rollback();
@@ -115,7 +115,7 @@ private void trxSend(final Object result) throws Exception {
115115
log.debug(" [{}] removing readonly mode from connection", sessionId);
116116
setReadOnly.accept(false);
117117
}
118-
} catch (Exception ex) {
118+
} catch (Throwable ex) {
119119
rollbackOnly = true;
120120
throw ex;
121121
} finally {
@@ -151,12 +151,12 @@ public void done() {
151151
}
152152

153153
@Override
154-
public void send(final Object result) throws Exception {
154+
public void send(final Object result) throws Throwable {
155155
trxSend(result);
156156
}
157157

158158
@Override
159-
public void send(final Result result) throws Exception {
159+
public void send(final Result result) throws Throwable {
160160
trxSend(result);
161161
}
162162

jooby-metrics/src/main/java/org/jooby/metrics/HealthCheckHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
public class HealthCheckHandler implements Handler {
4444

4545
@Override
46-
public void handle(final Request req, final Response rsp) throws Exception {
46+
public void handle(final Request req, final Response rsp) throws Throwable {
4747
HealthCheckRegistry registry = req.require(HealthCheckRegistry.class);
4848
SortedMap<String, Result> checks = req.param("name").toOptional().map(name -> {
4949
SortedMap<String, Result> set = ImmutableSortedMap.of(name, registry.runHealthCheck(name));

jooby-metrics/src/main/java/org/jooby/metrics/MetricHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class MetricHandler implements Handler {
6060
private static final String NO_CACHE = "must-revalidate,no-cache,no-store";
6161

6262
@Override
63-
public void handle(final Request req, final Response rsp) throws Exception {
63+
public void handle(final Request req, final Response rsp) throws Throwable {
6464
MetricRegistry registry = req.require(MetricRegistry.class);
6565
Map<String, Metric> allmetrics = registry.getMetrics();
6666
if (allmetrics.isEmpty()) {

jooby-metrics/src/main/java/org/jooby/metrics/PingHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class PingHandler implements Handler {
3737

3838
@Override
39-
public void handle(final Request req, final Response rsp) throws Exception {
39+
public void handle(final Request req, final Response rsp) throws Throwable {
4040
rsp.status(Status.OK)
4141
.type(MediaType.plain)
4242
.header("Cache-Control", "must-revalidate,no-cache,no-store")

jooby-metrics/src/main/java/org/jooby/metrics/ThreadDumpHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class ThreadDumpHandler implements Handler {
5454
}
5555

5656
@Override
57-
public void handle(final Request req, final Response rsp) throws Exception {
57+
public void handle(final Request req, final Response rsp) throws Throwable {
5858
Object data;
5959
Status status;
6060
if (threadDump == null) {

jooby-pac4j/src/main/java/org/jooby/internal/pac4j/AuthContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public String getRequestMethod() {
9898
public void writeResponseContent(final String content) {
9999
try {
100100
rsp.send(content);
101-
} catch (Exception ex) {
101+
} catch (Throwable ex) {
102102
throw new Err(Status.SERVER_ERROR, ex);
103103
}
104104
}

0 commit comments

Comments
 (0)