Skip to content

Commit a6ba32a

Browse files
committed
remove unwanted code
1 parent 7442ce4 commit a6ba32a

File tree

2 files changed

+10
-40
lines changed

2 files changed

+10
-40
lines changed

src/app/core/interceptors/httpInterceptor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class HttpConfigInterceptor implements HttpInterceptor {
154154
return next.handle(request).pipe(
155155
catchError((error) => {
156156
if (error instanceof HttpErrorResponse) {
157-
this.handleSentryError(error, request);
157+
this.trackErrorInSentry(error, request);
158158
if (this.expiringSoon(token)) {
159159
return from(this.refreshAccessToken()).pipe(
160160
mergeMap((newToken) => {
@@ -180,7 +180,7 @@ export class HttpConfigInterceptor implements HttpInterceptor {
180180
);
181181
}
182182

183-
private handleSentryError(error: HttpErrorResponse, request: HttpRequest<string>): void {
183+
private trackErrorInSentry(error: HttpErrorResponse, request: HttpRequest<string>): void {
184184
if (error.status >= 500) {
185185
const errorObject = new Error(`API ${error.status} Error: ${error.message || 'Server error'}`);
186186

src/app/fyle/my-view-report/my-view-report.page.ts

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import { ReportPermissions } from 'src/app/core/models/report-permissions.model'
3737
import { ExtendedComment } from 'src/app/core/models/platform/v1/extended-comment.model';
3838
import { Comment } from 'src/app/core/models/platform/v1/comment.model';
3939
import { ExpenseTransactionStatus } from 'src/app/core/enums/platform/v1/expense-transaction-status.enum';
40-
import * as Sentry from '@sentry/angular';
41-
import { HttpErrorResponse } from '@angular/common/http';
4240

4341
@Component({
4442
selector: 'app-my-view-report',
@@ -456,42 +454,14 @@ export class MyViewReportPage {
456454
this.spenderReportsService
457455
.submit(this.reportId)
458456
.pipe(finalize(() => (this.submitReportLoader = false)))
459-
.subscribe({
460-
next: () => {
461-
this.router.navigate(['/', 'enterprise', 'my_reports']);
462-
const message = `Report submitted successfully.`;
463-
this.matSnackBar.openFromComponent(ToastMessageComponent, {
464-
...this.snackbarProperties.setSnackbarProperties('success', { message }),
465-
panelClass: ['msb-success-with-camera-icon'],
466-
});
467-
this.trackingService.showToastMessage({ ToastContent: message });
468-
},
469-
error: (error: HttpErrorResponse) => {
470-
const errorMessage = `Report Submit Error ${error.status}: ${
471-
error?.message || error.statusText || 'Unknown Error'
472-
}`;
473-
const errorObj = new Error(errorMessage);
474-
475-
Object.assign(errorObj, {
476-
status: error.status,
477-
url: error.url,
478-
responseData: error.message,
479-
name: `ReportSubmitError_${this.reportId}`,
480-
});
481-
482-
Sentry.captureException(errorObj, {
483-
tags: {
484-
errorType: 'REPORT_SUBMIT_ERROR',
485-
reportId: this.reportId,
486-
},
487-
extra: {
488-
reportId: this.reportId,
489-
responseStatus: error.status,
490-
responseData: error.error,
491-
page: 'submit_report',
492-
},
493-
});
494-
},
457+
.subscribe(() => {
458+
this.router.navigate(['/', 'enterprise', 'my_reports']);
459+
const message = `Report submitted successfully.`;
460+
this.matSnackBar.openFromComponent(ToastMessageComponent, {
461+
...this.snackbarProperties.setSnackbarProperties('success', { message }),
462+
panelClass: ['msb-success-with-camera-icon'],
463+
});
464+
this.trackingService.showToastMessage({ ToastContent: message });
495465
});
496466
}
497467

0 commit comments

Comments
 (0)