Skip to content

Commit

Permalink
chore: Added the sentry to trace issues (#3368)
Browse files Browse the repository at this point in the history
  • Loading branch information
devendrafyle authored Dec 17, 2024
1 parent 160753f commit e0573c6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 11 deletions.
28 changes: 20 additions & 8 deletions src/app/fyle/my-view-report/my-view-report.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { ReportPermissions } from 'src/app/core/models/report-permissions.model'
import { ExtendedComment } from 'src/app/core/models/platform/v1/extended-comment.model';
import { Comment } from 'src/app/core/models/platform/v1/comment.model';
import { ExpenseTransactionStatus } from 'src/app/core/enums/platform/v1/expense-transaction-status.enum';
import * as Sentry from '@sentry/angular';

@Component({
selector: 'app-my-view-report',
Expand Down Expand Up @@ -444,14 +445,25 @@ export class MyViewReportPage {
}

submitReport(): void {
this.spenderReportsService.submit(this.reportId).subscribe(() => {
this.router.navigate(['/', 'enterprise', 'my_reports']);
const message = `Report submitted successfully.`;
this.matSnackBar.openFromComponent(ToastMessageComponent, {
...this.snackbarProperties.setSnackbarProperties('success', { message }),
panelClass: ['msb-success-with-camera-icon'],
});
this.trackingService.showToastMessage({ ToastContent: message });
this.spenderReportsService.submit(this.reportId).subscribe({
next: () => {
this.router.navigate(['/', 'enterprise', 'my_reports']);
const message = `Report submitted successfully.`;
this.matSnackBar.openFromComponent(ToastMessageComponent, {
...this.snackbarProperties.setSnackbarProperties('success', { message }),
panelClass: ['msb-success-with-camera-icon'],
});
this.trackingService.showToastMessage({ ToastContent: message });
},
error: (error) => {
// Capture error with additional details in Sentry
Sentry.captureException(error, {
extra: {
reportId: this.reportId,
errorResponse: error,
},
});
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DEVICE_PLATFORM } from 'src/app/constants';
import { CameraState } from 'src/app/core/enums/camera-state.enum';
import { CameraPreviewService } from 'src/app/core/services/camera-preview.service';
import { CameraService } from 'src/app/core/services/camera.service';
import * as Sentry from '@sentry/angular';

@Component({
selector: 'app-camera-preview',
Expand Down Expand Up @@ -81,6 +82,7 @@ export class CameraPreviewComponent implements OnInit, OnChanges {

startCameraPreview(): void {
if (![CameraState.STARTING, CameraState.RUNNING].includes(this.cameraState)) {
const currentCameraState = this.cameraState;
this.cameraState = CameraState.STARTING;
const cameraPreviewOptions: CameraPreviewOptions = {
position: 'rear',
Expand All @@ -91,9 +93,24 @@ export class CameraPreviewComponent implements OnInit, OnChanges {
disableAudio: true,
};

from(this.cameraPreviewService.start(cameraPreviewOptions)).subscribe(() => {
this.cameraState = CameraState.RUNNING;
this.getFlashModes();
from(this.cameraPreviewService.start(cameraPreviewOptions)).subscribe({
next: () => {
this.cameraState = CameraState.RUNNING;
this.getFlashModes();
},
error: (error) => {
Sentry.captureException(error, {
extra: {
errorResponse: error,
currentCameraState,
cameraState: this.cameraState,
navigationState: window.location.href,
options: cameraPreviewOptions,
platform: this.devicePlatform,
timestamp: new Date().toISOString(),
},
});
},
});
}
}
Expand Down

0 comments on commit e0573c6

Please sign in to comment.