JsonRPCErrors .java

net.minecraft.server.jsonrpc.JsonRPCErrors (enum): members: PARSE_ERROR, INVALID_REQUEST, METHOD_NOT_FOUND, INVALID_PARAMS, INTERNAL_ERROR, errorCode.

net.minecraft.server.jsonrpcenum35 linesserver1.0 KB

API Surface (3)

JsonObject createWithUnknownId(final @Nullable String data)
JsonObject createWithoutData(final JsonElement id)
JsonObject create(final JsonElement id, final String data)

Fields & Constants (2)

errorCode
message

String literals (5)

"Parse error"
"Invalid Request"
"Method not found"
"Invalid params"
"Internal error"

Code Graph: Dependencies (1)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

JsonRPCErrors.java35 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.jsonrpc;
2
3
import com.google.gson.JsonElement;
4
import com.google.gson.JsonNull;
5
import com.google.gson.JsonObject;
6
import org.jspecify.annotations.Nullable;
7
8
public enum JsonRPCErrors {
9
	PARSE_ERROR(-32700, "Parse error"),
10
	INVALID_REQUEST(-32600, "Invalid Request"),
11
	METHOD_NOT_FOUND(-32601, "Method not found"),
12
	INVALID_PARAMS(-32602, "Invalid params"),
13
	INTERNAL_ERROR(-32603, "Internal error");
14
15
	private final int errorCode;
16
	private final String message;
17
18
	JsonRPCErrors(final int errorCode, final String message) {
19
		this.errorCode = errorCode;
20
		this.message = message;
21
	}
22
23
	public JsonObject createWithUnknownId(final @Nullable String data) {
24
		return JsonRPCUtils.createError(JsonNull.INSTANCE, this.message, this.errorCode, data);
25
	}
26
27
	public JsonObject createWithoutData(final JsonElement id) {
28
		return JsonRPCUtils.createError(id, this.message, this.errorCode, null);
29
	}
30
31
	public JsonObject create(final JsonElement id, final String data) {
32
		return JsonRPCUtils.createError(id, this.message, this.errorCode, data);
33
	}
34
}
35

Decompiled Minecraft 26.3 source of JsonRPCErrors (net/minecraft/server/jsonrpc/JsonRPCErrors.java) with Mojang official mappings, stored verbatim on the site.