Skip to content

Commit

Permalink
Add email to loops error to understand why is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgutgon committed Oct 30, 2024
1 parent 10b1868 commit 9a2394f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/events/handlers/createLoopsContact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export async function createLoopsContact({

const client = new LoopsClient(apiKey)
const data = event.data
const response = await client.createContact(data.userEmail, {
const userEmail = data.userEmail
const response = await client.createContact(userEmail, {
userId: data.id,
firstName: data.name,
workspaceId: data.workspaceId,
Expand All @@ -36,7 +37,7 @@ export async function createLoopsContact({

if (!response.success) {
// This will be capture by Workers Sentry
throw new Error(response.message)
throw new Error(`For email: ${userEmail}: ${response.message}`)
}

return Result.ok(response.id)
Expand Down

0 comments on commit 9a2394f

Please sign in to comment.