feat: emit stable json errors

This commit is contained in:
Eric Wendland 2026-07-05 18:30:44 +02:00
commit 675e3fb45d
4 changed files with 108 additions and 4 deletions

View file

@ -344,6 +344,24 @@ fn stable_json_output_matches_fixtures() {
);
}
#[test]
fn json_errors_include_stable_code_for_common_failures() {
let home = tempfile::tempdir().expect("tempdir");
let output = run_geth(home.path(), &["--json", "status"]);
assert!(!output.status.success());
let error = serde_json::from_slice::<serde_json::Value>(&output.stdout)
.expect("decode json error output");
assert_eq!(error["type"], "error");
assert_eq!(error["code"], "daemon_unavailable");
assert!(
error["message"]
.as_str()
.expect("error message")
.contains("connect to daemon")
);
}
#[test]
fn peer_ping_uses_daemon_owned_iroh_endpoint() {
if skip_iroh_integration_tests() {