Class DataSourceStatusProvider.ErrorInfo
- java.lang.Object
-
- com.launchdarkly.sdk.server.interfaces.DataSourceStatusProvider.ErrorInfo
-
- Enclosing interface:
- DataSourceStatusProvider
public static final class DataSourceStatusProvider.ErrorInfo extends java.lang.ObjectA description of an error condition that the data source encountered.
-
-
Constructor Summary
Constructors Constructor Description ErrorInfo(DataSourceStatusProvider.ErrorKind kind, int statusCode, java.lang.String message, java.time.Instant time)Constructs an instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)static DataSourceStatusProvider.ErrorInfofromException(DataSourceStatusProvider.ErrorKind kind, java.lang.Throwable t)Constructs an instance based on an exception.static DataSourceStatusProvider.ErrorInfofromHttpError(int statusCode)Constructs an instance based on an HTTP error status.DataSourceStatusProvider.ErrorKindgetKind()Returns an enumerated value representing the general category of the error.java.lang.StringgetMessage()Returns any additional human-readable information relevant to the error.intgetStatusCode()Returns the HTTP status code if the error wasDataSourceStatusProvider.ErrorKind.ERROR_RESPONSE, or zero otherwise.java.time.InstantgetTime()Returns the date/time that the error occurred.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ErrorInfo
public ErrorInfo(DataSourceStatusProvider.ErrorKind kind, int statusCode, java.lang.String message, java.time.Instant time)
Constructs an instance.- Parameters:
kind- the general category of the errorstatusCode- an HTTP status or zeromessage- an error message if applicable, or nulltime- the error timestamp
-
-
Method Detail
-
fromException
public static DataSourceStatusProvider.ErrorInfo fromException(DataSourceStatusProvider.ErrorKind kind, java.lang.Throwable t)
Constructs an instance based on an exception.- Parameters:
kind- the general category of the errort- the exception- Returns:
- an ErrorInfo
-
fromHttpError
public static DataSourceStatusProvider.ErrorInfo fromHttpError(int statusCode)
Constructs an instance based on an HTTP error status.- Parameters:
statusCode- the status code- Returns:
- an ErrorInfo
-
getKind
public DataSourceStatusProvider.ErrorKind getKind()
Returns an enumerated value representing the general category of the error.- Returns:
- the general category of the error
-
getStatusCode
public int getStatusCode()
Returns the HTTP status code if the error wasDataSourceStatusProvider.ErrorKind.ERROR_RESPONSE, or zero otherwise.- Returns:
- an HTTP status or zero
-
getMessage
public java.lang.String getMessage()
Returns any additional human-readable information relevant to the error. The format of this message is subject to change and should not be relied on programmatically.- Returns:
- an error message if applicable, or null
-
getTime
public java.time.Instant getTime()
Returns the date/time that the error occurred.- Returns:
- the error timestamp
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-