Record Class JsonRpcError
java.lang.Object
java.lang.Record
dev.tachyonmcp.core.transport.jsonrpc.JsonRpcError
- Record Components:
code- the error codemessage- a short description of the errordata- optional additional error datahttpStatus- the HTTP status this protocol version ties to this error (200 by default — the JSON-RPC-over-HTTP convention where the transport succeeds even though the RPC failed; protocol versions that tie specific errors to HTTP status codes, e.g. MCP 2026-07-28, set this per error kind)
public record JsonRpcError(int code, String message, @Nullable String data, int httpStatus)
extends Record
A JSON-RPC error object, produced by a protocol version's
ProtocolResponseMapper.-
Constructor Summary
ConstructorsConstructorDescriptionJsonRpcError(int code, String message) Creates an error with no additional data, HTTP status 200.JsonRpcError(int code, String message, @Nullable String data) Creates an error with additional data, HTTP status 200.JsonRpcError(int code, String message, @Nullable String data, int httpStatus) Creates an instance of aJsonRpcErrorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcode()Returns the value of thecoderecord component.@Nullable Stringdata()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thehttpStatusrecord component.message()Returns the value of themessagerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JsonRpcError
Creates an error with no additional data, HTTP status 200. -
JsonRpcError
Creates an error with additional data, HTTP status 200. -
JsonRpcError
Creates an instance of aJsonRpcErrorrecord class.- Parameters:
code- the value for thecoderecord componentmessage- the value for themessagerecord componentdata- the value for thedatarecord componenthttpStatus- the value for thehttpStatusrecord component
-
-
Method Details
-
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 '=='. -
code
public int code()Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
httpStatus
public int httpStatus()Returns the value of thehttpStatusrecord component.- Returns:
- the value of the
httpStatusrecord component
-