Skip to content

Commit

Permalink
Log scanner's email in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneIRL committed Oct 7, 2023
1 parent b3ca19f commit ac2e5b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/admin/scanner/submit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import Event from '@/lib/db/models/Event'
import { ShopSwag, ShopSwagCollection } from '@/lib/db/models/ShopSwap'
import User, { getFullName } from '@/lib/db/models/User'
import logger from '@/lib/logger'
import { stringifyError, updatePoints } from '@/lib/utils/server'
import {
getEnhancedSession,
stringifyError,
updatePoints,
} from '@/lib/utils/server'
import { Collection, MongoClient } from 'mongodb'
import { headers } from 'next/headers'

export async function POST(request: NextRequest) {
const { user: operator } = getEnhancedSession(headers())
const checkInPin = request.nextUrl.searchParams.get('checkInPin')
const hexId = request.nextUrl.searchParams.get('hexId')?.toUpperCase()
const eventName = request.nextUrl.searchParams.get('eventName')
Expand All @@ -31,7 +37,7 @@ export async function POST(request: NextRequest) {

throw new Error('Missing search params')
} catch (e) {
logger.error(e, request.nextUrl.toString())
logger.error(e, operator?.email + '@@' + request.nextUrl.toString())
return NextResponse.json({ status: 'error', message: stringifyError(e) })
}
}
Expand Down

0 comments on commit ac2e5b8

Please sign in to comment.