Skip to content

Commit

Permalink
Sentry: fixed capturing exception/messages using user.username instea…
Browse files Browse the repository at this point in the history
…d of custom fields
  • Loading branch information
choxx committed Jul 20, 2023
1 parent 570d2c6 commit a1fbfca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/api/api.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class ApiController {
if (!total || total == 0) {
Sentry.captureMessage('Phone number not registered', {
user: {
phone: phone,
username: phone,
applicationId: applicationId
}
});
Expand Down
4 changes: 3 additions & 1 deletion src/api/fusionauth/fusionauth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export class FusionauthService {
Sentry.captureException(e, {
user: {
applicationId: applicationId,
username: user.user.username,
user: user
}
});
Expand Down Expand Up @@ -310,7 +311,8 @@ export class FusionauthService {
user: {
id: userId,
applicationId: applicationId,
user: user
user: user,
username: user.user.username,
}
});
console.log(`Could not update user ${user.user.id}`, JSON.stringify(e));
Expand Down
4 changes: 2 additions & 2 deletions src/api/sms/cdac/cdac.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CdacService extends SmsService implements SMS {
} catch (error) {
Sentry.captureException(error, {
user: {
phone: data.phone
username: data.phone
}
});
throw new HttpException('TOTP generation failed!', 500);
Expand Down Expand Up @@ -101,7 +101,7 @@ export class CdacService extends SmsService implements SMS {
.catch((e: Error): OTPResponse => {
Sentry.captureException(e, {
user: {
phone: data.phone
username: data.phone
}
});
const error: SMSError = {
Expand Down
8 changes: 4 additions & 4 deletions src/api/sms/gupshup/gupshup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class GupshupService extends SmsService implements SMS {
if (r.error) {
Sentry.captureMessage(JSON.stringify(r), {
user: {
phone: data.phone
username: data.phone
}
});
}
Expand All @@ -110,7 +110,7 @@ export class GupshupService extends SmsService implements SMS {
.catch((e: Error): OTPResponse => {
Sentry.captureException(e, {
user: {
phone: data.phone
username: data.phone
}
});
const error: SMSError = {
Expand Down Expand Up @@ -174,7 +174,7 @@ export class GupshupService extends SmsService implements SMS {
if (r.error) {
Sentry.captureMessage(JSON.stringify(r), {
user: {
phone: data.phone
username: data.phone
}
});
}
Expand All @@ -188,7 +188,7 @@ export class GupshupService extends SmsService implements SMS {
.catch((e: Error): OTPResponse => {
Sentry.captureException(e, {
user: {
phone: data.phone
username: data.phone
}
});
const error: SMSError = {
Expand Down

0 comments on commit a1fbfca

Please sign in to comment.