Package com.tnsai.llm.observability
Record Class ErrorInfo
java.lang.Object
java.lang.Record
com.tnsai.llm.observability.ErrorInfo
public record ErrorInfo(String errorClass, String errorMessage, int httpStatus, Optional<String> providerErrorCode, boolean retryable)
extends Record
Failure detail for a non-successful LLM call (issue #79).
Captured by the LLM call wrapper into LLMCallLog.error();
empty when the call succeeded. Retains the throwable's class name +
message rather than the throwable itself so the log record stays
serializable across stores (the consumer's classpath may not have
the original exception class loaded).
httpStatus is 0 when the failure is at the transport
layer (DNS, connection reset) — i.e. no HTTP response was received.
- Since:
- 0.5.0 (issue #79)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorClassrecord component.Returns the value of theerrorMessagerecord component.static ErrorInfoBuild anErrorInfofrom a throwable, defaulting unknown fields.final inthashCode()Returns a hash code value for this object.intReturns the value of thehttpStatusrecord component.Returns the value of theproviderErrorCoderecord component.booleanReturns the value of theretryablerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ErrorInfo
public ErrorInfo(String errorClass, String errorMessage, int httpStatus, Optional<String> providerErrorCode, boolean retryable) Creates an instance of aErrorInforecord class.- Parameters:
errorClass- the value for theerrorClassrecord componenterrorMessage- the value for theerrorMessagerecord componenthttpStatus- the value for thehttpStatusrecord componentproviderErrorCode- the value for theproviderErrorCoderecord componentretryable- the value for theretryablerecord component
-
-
Method Details
-
from
public static ErrorInfo from(Throwable t, int httpStatus, String providerErrorCode, boolean retryable) Build anErrorInfofrom a throwable, defaulting unknown fields. The caller fills in HTTP status / provider code if they have it; otherwise pass 0 / empty. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
errorClass
Returns the value of theerrorClassrecord component.- Returns:
- the value of the
errorClassrecord component
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-
httpStatus
public int httpStatus()Returns the value of thehttpStatusrecord component.- Returns:
- the value of the
httpStatusrecord component
-
providerErrorCode
Returns the value of theproviderErrorCoderecord component.- Returns:
- the value of the
providerErrorCoderecord component
-
retryable
public boolean retryable()Returns the value of theretryablerecord component.- Returns:
- the value of the
retryablerecord component
-