mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-22 00:44:52 +02:00
Obfuscate error output
This commit is contained in:
@@ -36,7 +36,7 @@ export async function getTenantDb(
|
||||
.limit(1);
|
||||
|
||||
if (tenant.length === 0) {
|
||||
throw new Error(`Tenant with ID ${tenantId} not found`);
|
||||
throw new Error(`Tenant or client not found`);
|
||||
}
|
||||
|
||||
// Create tenant-specific database connection
|
||||
@@ -62,7 +62,7 @@ export async function getTenant(tenantId: string): Promise<centralSchema.SelectT
|
||||
.limit(1);
|
||||
|
||||
if (tenant.length === 0) {
|
||||
throw new Error(`Tenant with ID ${tenantId} not found`);
|
||||
throw new Error(`Tenant or client not found`);
|
||||
}
|
||||
|
||||
return tenant[0];
|
||||
|
||||
@@ -75,7 +75,7 @@ export class ClientPinResetService {
|
||||
|
||||
if (tunnel.length === 0) {
|
||||
log.warn("No client tunnel found for email hash", { emailHash: emailHash.slice(0, 8) });
|
||||
throw new NotFoundError("Client not found");
|
||||
throw new NotFoundError("Tenant or client not found");
|
||||
}
|
||||
|
||||
// Create reset token with expiration
|
||||
@@ -203,7 +203,7 @@ export class ClientPinResetService {
|
||||
.limit(1);
|
||||
|
||||
if (!tunnel) {
|
||||
throw new NotFoundError("Client tunnel not found");
|
||||
throw new NotFoundError("Tenant or client not found");
|
||||
}
|
||||
|
||||
// 3. Update the client tunnel with new keys
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ registerOpenAPIRoute("/tenants/{id}/appointments/{appointmentId}/delete-by-clien
|
||||
},
|
||||
},
|
||||
"404": {
|
||||
description: "Appointment or client not found",
|
||||
description: "Tenant or client not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: { $ref: "#/components/schemas/Error" },
|
||||
|
||||
@@ -87,7 +87,7 @@ registerOpenAPIRoute("/tenants/{id}/appointments/challenge", "POST", {
|
||||
},
|
||||
},
|
||||
"404": {
|
||||
description: "Client not found",
|
||||
description: "Tenant or client not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: { $ref: "#/components/schemas/Error" },
|
||||
@@ -186,7 +186,7 @@ export const POST: RequestHandler = async ({ request, params }) => {
|
||||
tenantId,
|
||||
emailHashPrefix: emailHash.slice(0, 8),
|
||||
});
|
||||
return json({ error: "Client not found" }, { status: 404 });
|
||||
return json({ error: "Tenant or client not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const tunnel = tunnelResult[0];
|
||||
|
||||
@@ -174,7 +174,7 @@ describe("Challenge API Route", () => {
|
||||
const data = await response.json();
|
||||
|
||||
expect(response.status).toBe(404);
|
||||
expect(data.error).toBe("Client not found");
|
||||
expect(data.error).toBe("Tenant or client not found");
|
||||
});
|
||||
|
||||
it("should handle database errors", async () => {
|
||||
|
||||
@@ -171,7 +171,7 @@ export const GET: RequestHandler = async ({ request, params }) => {
|
||||
tenantId,
|
||||
emailHashPrefix: validatedEmailHash.slice(0, 8),
|
||||
});
|
||||
throw new ValidationError("Client not found");
|
||||
throw new ValidationError("Tenant or client not found");
|
||||
}
|
||||
|
||||
const tunnel = tunnelResult[0];
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ describe("GET /api/tenants/[id]/appointments/my-appointments", () => {
|
||||
const data = await response.json();
|
||||
|
||||
expect(response.status).toBe(422);
|
||||
expect(data.error).toBe("Client not found");
|
||||
expect(data.error).toBe("Tenant or client not found");
|
||||
});
|
||||
|
||||
it("should return 422 when email hash is empty", async () => {
|
||||
|
||||
@@ -187,7 +187,7 @@ export const POST: RequestHandler = async ({ request, params }) => {
|
||||
challengeId,
|
||||
emailHashPrefix: storedChallenge.emailHash.slice(0, 8),
|
||||
});
|
||||
throw new NotFoundError("Client not found");
|
||||
throw new NotFoundError("Tenant or client not found");
|
||||
}
|
||||
|
||||
const tunnel = tunnelResult[0];
|
||||
|
||||
@@ -100,7 +100,7 @@ registerOpenAPIRoute("/tenants/{id}/clients/pin-reset/complete", "POST", {
|
||||
},
|
||||
},
|
||||
"404": {
|
||||
description: "Token or client not found",
|
||||
description: "Tenant or client not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: { $ref: "#/components/schemas/Error" },
|
||||
|
||||
@@ -99,7 +99,7 @@ registerOpenAPIRoute("/tenants/{id}/clients/pin-reset/init", "POST", {
|
||||
},
|
||||
},
|
||||
"404": {
|
||||
description: "Client not found",
|
||||
description: "Tenant or client not found",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: { $ref: "#/components/schemas/Error" },
|
||||
|
||||
@@ -80,7 +80,7 @@ describe("POST /api/tenants/[id]/clients/pin-reset/init", () => {
|
||||
});
|
||||
|
||||
it("should return 404 when client not found", async () => {
|
||||
mockPinResetService.createResetToken.mockRejectedValue(new Error("Client not found"));
|
||||
mockPinResetService.createResetToken.mockRejectedValue(new Error("Tenant or client not found"));
|
||||
|
||||
const request = new Request("http://localhost/api", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user