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.Object
A 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 boolean
equals(java.lang.Object other)
static DataSourceStatusProvider.ErrorInfo
fromException(DataSourceStatusProvider.ErrorKind kind, java.lang.Throwable t)
Constructs an instance based on an exception.static DataSourceStatusProvider.ErrorInfo
fromHttpError(int statusCode)
Constructs an instance based on an HTTP error status.DataSourceStatusProvider.ErrorKind
getKind()
Returns an enumerated value representing the general category of the error.java.lang.String
getMessage()
Returns any additional human-readable information relevant to the error.int
getStatusCode()
Returns the HTTP status code if the error wasDataSourceStatusProvider.ErrorKind.ERROR_RESPONSE
, or zero otherwise.java.time.Instant
getTime()
Returns the date/time that the error occurred.int
hashCode()
java.lang.String
toString()
-
-
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-