private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
long mappingPtr() throws IOException { long mappingPtr = mMappingPtr; if (mappingPtr == 0) { ClosedChannelException cce = new ClosedChannelException(); cce.initCause(mCause); throw cce; } return mappingPtr; }
long mappingPtr() throws IOException { long mappingPtr = mMappingPtr; if (mappingPtr == 0) { ClosedChannelException cce = new ClosedChannelException(); cce.initCause(mCause); throw cce; } return mappingPtr; }
long mappingPtr() throws IOException { long mappingPtr = mMappingPtr; if (mappingPtr == 0) { ClosedChannelException cce = new ClosedChannelException(); cce.initCause(mCause); throw cce; } return mappingPtr; }
/** * throws ClosedChannelException if remote peer socket closed */ private void throwCloseConnection() throws ClosedChannelException { ClosedChannelException closeEx = new ClosedChannelException(); closeEx.initCause(new IOException("Connection has been closed by peer")); throw closeEx; }
private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
private Throwable wrapStreamClosedError(Throwable cause) { // If the error was caused by STREAM_CLOSED we should use a ClosedChannelException to better // mimic other transports and make it easier to reason about what exceptions to expect. if (cause instanceof Http2Exception && ((Http2Exception) cause).error() == Http2Error.STREAM_CLOSED) { return new ClosedChannelException().initCause(cause); } return cause; }
/** * Convert ChannelFuture.cause() to a Status, taking into account that all handlers are removed * from the pipeline when the channel is closed. Since handlers are removed, you may get an * unhelpful exception like ClosedChannelException. * * <p>This method must only be called on the event loop. */ private Status statusFromFailedFuture(ChannelFuture f) { Throwable t = f.cause(); if (t instanceof ClosedChannelException // Exception thrown by the StreamBufferingEncoder if the channel is closed while there // are still streams buffered. This exception is not helpful. Replace it by the real // cause of the shutdown (if available). || t instanceof Http2ChannelClosedException) { Status shutdownStatus = lifecycleManager.getShutdownStatus(); if (shutdownStatus == null) { return Status.UNKNOWN.withDescription("Channel closed but for unknown reason") .withCause(new ClosedChannelException().initCause(t)); } return shutdownStatus; } return Utils.statusFromThrowable(t); } }
public static Status statusFromThrowable(Throwable t) { Status s = Status.fromThrowable(t); if (s.getCode() != Status.Code.UNKNOWN) { return s; } if (t instanceof ClosedChannelException) { // ClosedChannelException is used any time the Netty channel is closed. Proper error // processing requires remembering the error that occurred before this one and using it // instead. // // Netty uses an exception that has no stack trace, while we would never hope to show this to // users, if it happens having the extra information may provide a small hint of where to // look. ClosedChannelException extraT = new ClosedChannelException(); extraT.initCause(t); return Status.UNKNOWN.withDescription("channel closed").withCause(extraT); } if (t instanceof IOException) { return Status.UNAVAILABLE.withDescription("io exception").withCause(t); } if (t instanceof Http2Exception) { return Status.INTERNAL.withDescription("http2 exception").withCause(t); } return s; }
public static Status statusFromThrowable(Throwable t) { Status s = Status.fromThrowable(t); if (s.getCode() != Status.Code.UNKNOWN) { return s; } if (t instanceof ClosedChannelException) { // ClosedChannelException is used any time the Netty channel is closed. Proper error // processing requires remembering the error that occurred before this one and using it // instead. // // Netty uses an exception that has no stack trace, while we would never hope to show this to // users, if it happens having the extra information may provide a small hint of where to // look. ClosedChannelException extraT = new ClosedChannelException(); extraT.initCause(t); return Status.UNKNOWN.withDescription("channel closed").withCause(extraT); } if (t instanceof IOException) { return Status.UNAVAILABLE.withDescription("io exception").withCause(t); } if (t instanceof Http2Exception) { return Status.INTERNAL.withDescription("http2 exception").withCause(t); } return s; }