From 94ebacdf807bd03f8a710daa8e805072bdba3ab3 Mon Sep 17 00:00:00 2001 From: Dhruvik Neharia Date: Thu, 8 Jun 2023 08:17:51 +0530 Subject: [PATCH] chore: Add two more sentry logs when REQUEST_NOT_AUTHORISED and PAGE_NOT_FOUND alongwith rejecting respective promises with the whole error object (#24203) ## Description #### PR fixes following issue(s) Fixes #23972 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --- app/client/src/ce/api/ApiUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/client/src/ce/api/ApiUtils.ts b/app/client/src/ce/api/ApiUtils.ts index 8febf62ce3..e0cb46fecb 100644 --- a/app/client/src/ce/api/ApiUtils.ts +++ b/app/client/src/ce/api/ApiUtils.ts @@ -200,7 +200,9 @@ export const apiFailureResponseInterceptor = (error: any) => { )}`, }), ); + Sentry.captureException(error); return Promise.reject({ + ...error, code: ERROR_CODES.REQUEST_NOT_AUTHORISED, message: "Unauthorized. Redirecting to login page...", show: false, @@ -212,7 +214,9 @@ export const apiFailureResponseInterceptor = (error: any) => { (SERVER_ERROR_CODES.RESOURCE_NOT_FOUND.includes(errorData.error.code) || SERVER_ERROR_CODES.UNABLE_TO_FIND_PAGE.includes(errorData.error.code)) ) { + Sentry.captureException(error); return Promise.reject({ + ...error, code: ERROR_CODES.PAGE_NOT_FOUND, message: "Resource Not Found", show: false,