fix: show why SSH connection tests and runs fail (#7)
Test connection, key installation and runs now tell authentication failures apart from unreachable hosts (refused, timeout, DNS, ...) instead of a generic "SSH connection failed". The web client keeps the server's deliberate error messages (4xx, 502, 503) and shows them in the hosts page; unexpected 500 errors still show only the status. The reload hint appears only on 409 conflicts.
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
httpError,
|
||||
SerialQueue,
|
||||
} from "../workspace";
|
||||
import { connect, exec, forgetHostKey, HostKeyError } from "../ssh";
|
||||
import { connect, exec, forgetHostKey, HostKeyError, sshFailure } from "../ssh";
|
||||
import { CredentialStore } from "./credentials";
|
||||
import { validateHost } from "./validation";
|
||||
const saves = new SerialQueue();
|
||||
@@ -221,7 +221,7 @@ export async function hostsPlugin(
|
||||
changed: e.changed,
|
||||
},
|
||||
};
|
||||
throw httpError(502, "SSH connection or action failed");
|
||||
throw httpError(502, sshFailure(e) ?? "SSH connection or action failed");
|
||||
} finally {
|
||||
client?.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user