mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 09:07:46 +02:00
Expose trusted cloud import errors
This commit is contained in:
1 parent
a5e48a51eb
commit
155bcb6ded
2 files changed
+35
-1
No files matched your search
@@ -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";
|
||||
}
|
||||
Reference in new issue
Block a user