Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
add debug logs (#1734)
Browse files Browse the repository at this point in the history
  • Loading branch information
timarney authored Jul 9, 2021
1 parent e912ca1 commit c2bf6c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/screens/qr/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const base64ToUint8Array = (str: string) => {
const parseData = (data: string) => {
const _locationData = data.split('\n');

log.debug({
category: 'qr-code',
message: 'parse-data',
payload: {data},
});

return {
id: _locationData[0],
name: _locationData[1],
Expand All @@ -45,7 +51,8 @@ export const handleOpenURL = async ({url}: EventURL): Promise<CheckInData> => {
const data = nacl.sign.open(base64ToUint8Array(base64Str), base64ToUint8Array(QR_CODE_PUBLIC_KEY));

if (!data) {
throw new Error();
log.error({category: 'qr-code', message: 'QR_CODE_PUBLIC_KEY failed to verify'});
throw new Error('QR_CODE_PUBLIC_KEY failed to verify');
}

// @ts-ignore
Expand All @@ -70,6 +77,8 @@ export const handleOpenURL = async ({url}: EventURL): Promise<CheckInData> => {
filteredMetricsService.addEvent({
type: EventTypeMetric.Error500QrParse,
});

log.error({category: 'qr-code', message: error.message, error: EventTypeMetric.Error500QrParse});
throw new Error('Problem decoding or parsing QR hash data');
}
};
Expand Down

0 comments on commit c2bf6c1

Please sign in to comment.