Nextcloud: Netzfehler mit Ursache melden (0.44.4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
Claude
2026-11-04 21:26:50 +00:00
parent 7e18b7f4de
commit c68fadbc60
6 changed files with 42 additions and 5 deletions

View File

@@ -65,3 +65,14 @@ describe("vCard", () => {
expect(fingerabdruck({ name: "A B" })).toBe(fingerabdruck({ name: "A B", firma: null }));
});
});
describe("Netzfehler mit Ursache", () => {
it("zeigt code und message aus err.cause", async () => {
const { abrufMitUrsache, fehlerText } = await import("../src/server/nextcloud.js");
const tls = Object.assign(new Error("unable to verify the first certificate"), { code: "UNABLE_TO_VERIFY_LEAF_SIGNATURE" });
const fehler = new TypeError("fetch failed", { cause: tls });
expect(fehlerText(fehler)).toBe("fetch failed – UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate");
const abruf = (async () => { throw fehler; }) as unknown as typeof fetch;
await expect(abrufMitUrsache(abruf, "https://cloud.test/remote.php/dav", {})).rejects.toThrow("cloud.test nicht erreichbar: fetch failed – UNABLE_TO_VERIFY_LEAF_SIGNATURE");
});
});