Skip to content

Commit

Permalink
Http2LifecycleManager.onException rename
Browse files Browse the repository at this point in the history
Motivation:
Http2LifecycleManager.onException takes a Throwable as a paramter and not an Exception. There are also onConnectionError and onStreamError methods in the codec. We should rename this method to onError for consistency and clarity.

Modifications:
- Rename Http2LifecycleManager.onException to Http2LifecycleManager.onError

Result:
More consistent and clarified interface.
  • Loading branch information
Scottmitch committed Sep 23, 2015
1 parent 1c14e5b commit 5edffb7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public ChannelFuture writeHeaders(final ChannelHandlerContext ctx, final int str
endOfStream, promise));
return promise;
} catch (Http2NoMoreStreamIdsException e) {
lifecycleManager.onException(ctx, e);
lifecycleManager.onError(ctx, e);
return promise.setFailure(e);
} catch (Throwable e) {
return promise.setFailure(e);
Expand Down Expand Up @@ -332,7 +332,7 @@ public int size() {
@Override
public void error(ChannelHandlerContext ctx, Throwable cause) {
queue.releaseAndFailAll(cause);
lifecycleManager.onException(ctx, cause);
lifecycleManager.onError(ctx, cause);
promise.tryFailure(cause);
}

Expand Down Expand Up @@ -400,7 +400,7 @@ public int size() {
@Override
public void error(ChannelHandlerContext ctx, Throwable cause) {
if (ctx != null) {
lifecycleManager.onException(ctx, cause);
lifecycleManager.onError(ctx, cause);
}
promise.tryFailure(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) thro
byteDecoder.decode(ctx, in, out);
}
} catch (Throwable e) {
onException(ctx, e);
onError(ctx, e);
}
}

Expand Down Expand Up @@ -388,7 +388,7 @@ public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) thro
try {
decoder.decodeFrame(ctx, in, out);
} catch (Throwable e) {
onException(ctx, e);
onError(ctx, e);
}
}
}
Expand Down Expand Up @@ -490,7 +490,7 @@ public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onException(ctx, cause);
onError(ctx, cause);
} else {
super.exceptionCaught(ctx, cause);
}
Expand Down Expand Up @@ -556,7 +556,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
* Central handler for all exceptions caught during HTTP/2 processing.
*/
@Override
public void onException(ChannelHandlerContext ctx, Throwable cause) {
public void onError(ChannelHandlerContext ctx, Throwable cause) {
Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) {
onStreamError(ctx, cause, (StreamException) embedded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ChannelFuture goAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode
ByteBuf debugData, ChannelPromise promise);

/**
* Processes the given exception.
* Processes the given error.
*/
void onException(ChannelHandlerContext ctx, Throwable cause);
void onError(ChannelHandlerContext ctx, Throwable cause);
}

0 comments on commit 5edffb7

Please sign in to comment.