Package alluxio.exception.status
Class AlluxioStatusException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- alluxio.exception.status.AlluxioStatusException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AbortedException
,AlreadyExistsException
,CanceledException
,CancelledException
,DataLossException
,DeadlineExceededException
,FailedPreconditionException
,InternalException
,InvalidArgumentException
,NotFoundException
,OutOfRangeException
,PermissionDeniedException
,ResourceExhaustedException
,UnauthenticatedException
,UnavailableException
,UnimplementedException
,UnknownException
public class AlluxioStatusException extends java.io.IOException
An exception thrown by Alluxio.getStatusCode()
can be used to determine the represented class of error.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AlluxioStatusException(io.grpc.Status status)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AlluxioStatusException
from(io.grpc.Status status)
Converts an Alluxio exception from status and message representation to native representation.static AlluxioStatusException
fromAlluxioException(AlluxioException ae)
Converts checked Alluxio exceptions to Alluxio status exceptions.static AlluxioStatusException
fromCheckedException(java.lang.Throwable throwable)
Converts checked throwables to Alluxio status exceptions.static AlluxioStatusException
fromIOException(java.io.IOException ioe)
Converts an IOException to a corresponding status exception.static AlluxioStatusException
fromStatusRuntimeException(io.grpc.StatusRuntimeException e)
Converts a gRPC StatusRuntimeException to an Alluxio status exception.static AlluxioStatusException
fromThrowable(java.lang.Throwable t)
Converts an arbitrary throwable to an Alluxio status exception.io.grpc.Status
getStatus()
io.grpc.Status.Code
getStatusCode()
AlluxioException
toAlluxioException()
io.grpc.StatusException
toGrpcStatusException()
-
-
-
Method Detail
-
getStatus
public io.grpc.Status getStatus()
- Returns:
- the internal status for this exception
-
getStatusCode
public io.grpc.Status.Code getStatusCode()
- Returns:
- the status code for this exception
-
toAlluxioException
public AlluxioException toAlluxioException()
- Returns:
- a specific
AlluxioException
corresponding to this exception if there is one; otherwise return a genericAlluxioException
-
toGrpcStatusException
public io.grpc.StatusException toGrpcStatusException()
- Returns:
- a gRPC status exception representation of this exception
-
from
public static AlluxioStatusException from(io.grpc.Status status)
Converts an Alluxio exception from status and message representation to native representation. The status must not be null orStatus.OK
.- Parameters:
status
- the status- Returns:
- an
AlluxioStatusException
for the given status and message
-
fromCheckedException
public static AlluxioStatusException fromCheckedException(java.lang.Throwable throwable)
Converts checked throwables to Alluxio status exceptions. Unchecked throwables should not be passed to this method. Use Throwables.propagateIfPossible before passing a Throwable to this method.- Parameters:
throwable
- a throwable- Returns:
- the converted
AlluxioStatusException
-
fromThrowable
public static AlluxioStatusException fromThrowable(java.lang.Throwable t)
Converts an arbitrary throwable to an Alluxio status exception. This method should be used with caution because it could potentially convert an unchecked exception (indicating a bug) to a checked Alluxio status exception.- Parameters:
t
- a throwable- Returns:
- the converted
AlluxioStatusException
-
fromStatusRuntimeException
public static AlluxioStatusException fromStatusRuntimeException(io.grpc.StatusRuntimeException e)
Converts a gRPC StatusRuntimeException to an Alluxio status exception.- Parameters:
e
- a gRPC StatusRuntimeException- Returns:
- the converted
AlluxioStatusException
-
fromAlluxioException
public static AlluxioStatusException fromAlluxioException(AlluxioException ae)
Converts checked Alluxio exceptions to Alluxio status exceptions.- Parameters:
ae
- the Alluxio exception to convert- Returns:
- the converted
AlluxioStatusException
-
fromIOException
public static AlluxioStatusException fromIOException(java.io.IOException ioe)
Converts an IOException to a corresponding status exception. Unless special cased, IOExceptions are converted toUnavailableException
.- Parameters:
ioe
- the IO exception to convert- Returns:
- the corresponding status exception
-
-