Added custom error with more details to debug the ciaran event issue (#9482)

This commit is contained in:
Jeroen Reumkens 2023-06-14 12:47:58 +02:00 committed by GitHub
parent fd9162e70f
commit 6b6043afdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,7 +192,20 @@ function getProfileFromEvent(event: Event) {
if (!profile) throw new Error("Event has no owner");
const username = "username" in profile ? profile.username : team?.slug;
if (!username) throw new Error("Event has no username/team slug");
if (!username) {
if (event.slug === "test") {
// @TODO: This is a temporary debug statement that should be removed asap.
throw new Error(
"Ciaran event error" +
JSON.stringify(team) +
" -- " +
JSON.stringify(hosts) +
" -- " +
JSON.stringify(owner)
);
}
throw new Error("Event has no username/team slug");
}
const weekStart = hosts?.[0]?.user?.weekStart || owner?.weekStart || "Monday";
const basePath = team ? `/team/${username}` : `/${username}`;
const eventMetaData = EventTypeMetaDataSchema.parse(event.metadata || {});