Make ThriftException extend RuntimeException, not Exception (#227)
This commit is contained in:
Родитель
dc073de17d
Коммит
d964d9f7f1
|
@ -537,7 +537,6 @@ class ThriftyCodeGenerator {
|
|||
.returns(typeResolver.getJavaClass(structType))
|
||||
.addParameter(TypeNames.PROTOCOL, "protocol")
|
||||
.addParameter(builderClassName, "builder")
|
||||
.addException(TypeNames.THRIFT_EXCEPTION)
|
||||
.addException(TypeNames.IO_EXCEPTION)
|
||||
|
||||
val readHelper = MethodSpec.methodBuilder("read")
|
||||
|
@ -545,7 +544,6 @@ class ThriftyCodeGenerator {
|
|||
.addModifiers(Modifier.PUBLIC)
|
||||
.returns(typeResolver.getJavaClass(structType))
|
||||
.addParameter(TypeNames.PROTOCOL, "protocol")
|
||||
.addException(TypeNames.THRIFT_EXCEPTION)
|
||||
.addException(TypeNames.IO_EXCEPTION)
|
||||
.addStatement("return read(protocol, new \$T())", builderClassName)
|
||||
.build()
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* Represents a Thrift protocol-level error.
|
||||
*/
|
||||
public class ThriftException extends Exception {
|
||||
public class ThriftException extends RuntimeException {
|
||||
/**
|
||||
* Identifies kinds of protocol violation.
|
||||
*/
|
||||
|
|
|
@ -202,7 +202,7 @@ public class AsyncClientBase extends ClientBase implements Closeable {
|
|||
Exception error = null;
|
||||
try {
|
||||
result = AsyncClientBase.this.invokeRequest(call);
|
||||
} catch (ThriftException | IOException | RuntimeException e) {
|
||||
} catch (IOException | RuntimeException e) {
|
||||
throw e;
|
||||
} catch (ServerException e) {
|
||||
error = e.thriftException;
|
||||
|
|
Загрузка…
Ссылка в новой задаче