fix: masquer les erreurs SQL des connecteurs web

This commit is contained in:
Manus
2026-09-30 13:55:36 +00:00
committed by manus-admin
parent 343ad71a59
commit a9c81b4238
3 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { WEB_IMPORT_SOURCE_SAVE_ERROR, getSafeWebImportSourceError } from "./webImportSourcesError";
describe("getSafeWebImportSourceError", () => {
it("never returns the SQL statement or connector parameters to the client", () => {
const databaseError = new Error(
"Failed query: insert into `webImportSources` (...) values (...) params: amazon@example.fr, secret-value",
);
const safeError = getSafeWebImportSourceError(databaseError);
expect(safeError.code).toBe("INTERNAL_SERVER_ERROR");
expect(safeError.message).toBe(WEB_IMPORT_SOURCE_SAVE_ERROR);
expect(safeError.message).not.toContain("insert into");
expect(safeError.message).not.toContain("secret-value");
});
});