package org.glassfish.grizzly.http2;
import java.io.IOException;
import org.glassfish.grizzly.http2.frames.ErrorCode;
public final class Http2StreamException extends IOException {
private final int streamId;
private final ErrorCode errorCode;
public Http2StreamException(final int streamId, final ErrorCode errorCode) {
this.streamId = streamId;
this.errorCode = errorCode;
}
public Http2StreamException(final int streamId, final ErrorCode errorCode,
final String description) {
super(description);
this.streamId = streamId;
this.errorCode = errorCode;
}
public Http2StreamException(final int streamId, final ErrorCode errorCode,
final Throwable cause) {
super(cause);
this.streamId = streamId;
this.errorCode = errorCode;
}
public Http2StreamException(final int streamId, final ErrorCode errorCode,
final String description, final Throwable cause) {
super(description, cause);
this.streamId = streamId;
this.errorCode = errorCode;
}
public int getStreamId() {
return streamId;
}
public ErrorCode getErrorCode() {
return errorCode;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(128);
sb.append(getClass().getName())
.append(" streamId=").append(streamId)
.append(" errorCode=").append(errorCode);
String message = getLocalizedMessage();
return message != null ?
(sb.append(": ").append(message).toString()) : sb.toString();
}
}