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

pull/9512/head^2
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
1 changed files with 14 additions and 1 deletions

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 || {});