Skip to content

Commit 803ad18

Browse files
committed
Rename catchAllErrorHandler to uncaughtErrorHandler
1 parent d98df02 commit 803ad18

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

vertx-web/src/main/java/io/vertx/ext/web/Router.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static Router router(Vertx vertx) {
382382
* @return a reference to this, so the API can be used fluently
383383
*/
384384
@Fluent
385-
Router catchAllErrorHandler(Handler<RoutingContext> errorHandler);
385+
Router uncaughtErrorHandler(Handler<RoutingContext> errorHandler);
386386

387387
/**
388388
* Used to route a context to the router. Used for sub-routers. You wouldn't normally call this method directly.

vertx-web/src/main/java/io/vertx/ext/web/impl/RouterImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ public synchronized Router errorHandler(int statusCode, Handler<RoutingContext>
297297
}
298298

299299
@Override
300-
public synchronized Router catchAllErrorHandler(Handler<RoutingContext> errorHandler) {
301-
state = state.setCatchAllErrorHandler(errorHandler);
300+
public synchronized Router uncaughtErrorHandler(Handler<RoutingContext> errorHandler) {
301+
state = state.setUncaughtErrorHandler(errorHandler);
302302
return this;
303303
}
304304

vertx-web/src/main/java/io/vertx/ext/web/impl/RouterState.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ final class RouterState {
5757
private final TreeSet<RouteImpl> routes;
5858
private final int orderSequence;
5959
private final Map<Integer, Handler<RoutingContext>> errorHandlers;
60-
private final Handler<RoutingContext> catchAllErrorHandler;
60+
private final Handler<RoutingContext> uncaughtErrorHandler;
6161
private final Handler<Router> modifiedHandler;
6262
private final AllowForwardHeaders allowForward;
6363
private final Map<String, Object> metadata;
6464

65-
public RouterState(RouterImpl router, TreeSet<RouteImpl> routes, int orderSequence, Map<Integer, Handler<RoutingContext>> errorHandlers, final Handler<RoutingContext> catchAllErrorHandler, Handler<Router> modifiedHandler, AllowForwardHeaders allowForward, Map<String, Object> metadata) {
65+
public RouterState(RouterImpl router, TreeSet<RouteImpl> routes, int orderSequence, Map<Integer, Handler<RoutingContext>> errorHandlers, final Handler<RoutingContext> uncaughtErrorHandler, Handler<Router> modifiedHandler, AllowForwardHeaders allowForward, Map<String, Object> metadata) {
6666
this.router = router;
6767
this.routes = routes;
6868
this.orderSequence = orderSequence;
6969
this.errorHandlers = errorHandlers;
70-
this.catchAllErrorHandler = catchAllErrorHandler;
70+
this.uncaughtErrorHandler = uncaughtErrorHandler;
7171
this.modifiedHandler = modifiedHandler;
7272
this.allowForward = allowForward;
7373
this.metadata = metadata;
@@ -102,7 +102,7 @@ RouterState setRoutes(Set<RouteImpl> routes) {
102102
new TreeSet<>(routeComparator),
103103
this.orderSequence,
104104
this.errorHandlers,
105-
this.catchAllErrorHandler,
105+
this.uncaughtErrorHandler,
106106
this.modifiedHandler,
107107
this.allowForward,
108108
this.metadata);
@@ -123,7 +123,7 @@ RouterState addRoute(RouteImpl route) {
123123
routes,
124124
this.orderSequence,
125125
this.errorHandlers,
126-
this.catchAllErrorHandler,
126+
this.uncaughtErrorHandler,
127127
this.modifiedHandler,
128128
this.allowForward,
129129
this.metadata);
@@ -135,7 +135,8 @@ RouterState clearRoutes() {
135135
new TreeSet<>(routeComparator),
136136
this.orderSequence,
137137
this.errorHandlers,
138-
null, this.modifiedHandler,
138+
null,
139+
this.modifiedHandler,
139140
this.allowForward,
140141
this.metadata);
141142
}
@@ -152,7 +153,7 @@ RouterState removeRoute(RouteImpl route) {
152153
routes,
153154
this.orderSequence,
154155
this.errorHandlers,
155-
this.catchAllErrorHandler,
156+
this.uncaughtErrorHandler,
156157
this.modifiedHandler,
157158
this.allowForward,
158159
this.metadata);
@@ -168,7 +169,7 @@ RouterState incrementOrderSequence() {
168169
this.routes,
169170
this.orderSequence + 1,
170171
this.errorHandlers,
171-
this.catchAllErrorHandler,
172+
this.uncaughtErrorHandler,
172173
this.modifiedHandler,
173174
this.allowForward,
174175
this.metadata);
@@ -180,7 +181,7 @@ RouterState setOrderSequence(int orderSequence) {
180181
this.routes,
181182
orderSequence,
182183
this.errorHandlers,
183-
this.catchAllErrorHandler,
184+
this.uncaughtErrorHandler,
184185
this.modifiedHandler,
185186
this.allowForward,
186187
this.metadata);
@@ -196,7 +197,7 @@ RouterState setErrorHandlers(Map<Integer, Handler<RoutingContext>> errorHandlers
196197
this.routes,
197198
this.orderSequence,
198199
errorHandlers,
199-
this.catchAllErrorHandler,
200+
this.uncaughtErrorHandler,
200201
this.modifiedHandler,
201202
this.allowForward,
202203
this.metadata);
@@ -209,7 +210,7 @@ Handler<RoutingContext> getErrorHandler(int errorCode) {
209210
return errorHandler;
210211
}
211212
}
212-
return catchAllErrorHandler;
213+
return uncaughtErrorHandler;
213214
}
214215

215216
RouterState putErrorHandler(int errorCode, Handler<RoutingContext> errorHandler) {
@@ -218,7 +219,7 @@ RouterState putErrorHandler(int errorCode, Handler<RoutingContext> errorHandler)
218219
this.routes,
219220
this.orderSequence,
220221
this.errorHandlers == null ? new HashMap<>() : new HashMap<>(errorHandlers),
221-
this.catchAllErrorHandler,
222+
this.uncaughtErrorHandler,
222223
this.modifiedHandler,
223224
this.allowForward,
224225
this.metadata);
@@ -227,7 +228,7 @@ RouterState putErrorHandler(int errorCode, Handler<RoutingContext> errorHandler)
227228
return newState;
228229
}
229230

230-
RouterState setCatchAllErrorHandler(Handler<RoutingContext> errorHandler) {
231+
RouterState setUncaughtErrorHandler(Handler<RoutingContext> errorHandler) {
231232
return new RouterState(
232233
this.router,
233234
this.routes,
@@ -249,7 +250,7 @@ public RouterState setModifiedHandler(Handler<Router> modifiedHandler) {
249250
this.routes,
250251
this.orderSequence,
251252
this.errorHandlers,
252-
this.catchAllErrorHandler,
253+
this.uncaughtErrorHandler,
253254
modifiedHandler,
254255
this.allowForward,
255256
this.metadata);
@@ -261,7 +262,7 @@ public RouterState setAllowForward(AllowForwardHeaders allow) {
261262
this.routes,
262263
this.orderSequence,
263264
this.errorHandlers,
264-
this.catchAllErrorHandler,
265+
this.uncaughtErrorHandler,
265266
this.modifiedHandler,
266267
allow,
267268
this.metadata);
@@ -283,7 +284,7 @@ public RouterState putMetadata(String key, Object value) {
283284
this.routes,
284285
this.orderSequence,
285286
this.errorHandlers,
286-
this.catchAllErrorHandler,
287+
this.uncaughtErrorHandler,
287288
this.modifiedHandler,
288289
this.allowForward,
289290
Collections.unmodifiableMap(metadata));

vertx-web/src/test/java/io/vertx/ext/web/RouterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3647,9 +3647,9 @@ public void testExtractCallee() throws Exception {
36473647
}
36483648

36493649
@Test
3650-
public void testCatchAllErrorHandler() throws Exception {
3650+
public void testUncaughtErrorHandler() throws Exception {
36513651
router.route().consumes("text/html").handler(rc -> rc.response().end());
3652-
router.catchAllErrorHandler(context -> context.response().setStatusCode(context.statusCode()).setStatusMessage("Dumb").end());
3652+
router.uncaughtErrorHandler(context -> context.response().setStatusCode(context.statusCode()).setStatusMessage("Dumb").end());
36533653

36543654
testRequestWithContentType(HttpMethod.GET, "/foo", "something/html", 415, "Dumb");
36553655
}

0 commit comments

Comments
 (0)