Expose trusted cloud import errors

This commit is contained in:
Dotta committed 2026-05-19 13:54:54 -05:00
1 parent a5e48a51eb
commit 155bcb6ded
2 files changed
+35 -1

No files matched your search

+10 -1
View File
@@ -74,5 +74,14 @@ export function errorHandler(
const tc = getTelemetryClient();
if (tc) trackErrorHandlerCrash(tc, { errorCode: rootError.name });
res.status(500).json({ error: "Internal server error" });
res.status(500).json({
error: "Internal server error",
...(shouldExposeTrustedCloudTenantImportError(req) ? { message: rootError.message } : {}),
});
}
function shouldExposeTrustedCloudTenantImportError(req: Request) {
return req.actor?.source === "cloud_tenant"
&& req.method === "POST"
&& req.originalUrl.split("?")[0] === "/api/companies/import";
}