mirror of
https://github.com/sbt/sbt.git
synced 2026-09-03 08:34:34 +02:00
WorkerMain: exit quietly on invalid JSON-RPC input (no stack trace)
When input lacks 'jsonrpc' field (e.g. {}), call System.exit(1) instead
of throwing IllegalArgumentException. Avoids noisy stack traces in
CI from WorkerExchangeTest's intentional bad-input tests.
This commit is contained in:
@@ -115,7 +115,8 @@ public final class WorkerMain {
|
||||
JsonElement elem = JsonParser.parseString(json);
|
||||
JsonObject o = elem.getAsJsonObject();
|
||||
if (!o.has("jsonrpc")) {
|
||||
throw new IllegalArgumentException("jsonrpc expected but got: " + json);
|
||||
// Exit without stack trace so CI / test runners do not treat stderr as failure
|
||||
System.exit(1);
|
||||
}
|
||||
Gson g = WorkerMain.mkGson();
|
||||
long id = o.getAsJsonPrimitive("id").getAsLong();
|
||||
|
||||
Reference in New Issue
Block a user