Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle guest feature error, no nested catch #2709

Merged
merged 9 commits into from
Mar 28, 2024

Conversation

RulaKhaled
Copy link
Contributor

@RulaKhaled RulaKhaled commented Mar 18, 2024

Description

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-qa
Copy link

codecov-qa bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (67c882b) to head (701d46a).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2709   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         855      855           
  Lines       12087    12092    +5     
  Branches     3163     3181   +18     
=======================================
+ Hits        11898    11903    +5     
  Misses        185      185           
  Partials        4        4           
Files Coverage Δ
src/shared/api/api.js 98.00% <100.00%> (+0.22%) ⬆️
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <ø> (ø)
Services 99.57% <ø> (ø)
Shared 99.83% <100.00%> (+<0.01%) ⬆️
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67c882b...701d46a. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2709   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         855      855           
  Lines       12087    12092    +5     
  Branches     3163     3129   -34     
=======================================
+ Hits        11898    11903    +5     
  Misses        185      185           
  Partials        4        4           
Files Coverage Δ
src/shared/api/api.js 98.00% <100.00%> (+0.22%) ⬆️
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <ø> (ø)
Services 99.57% <ø> (ø)
Shared 99.83% <100.00%> (+<0.01%) ⬆️
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67c882b...701d46a. Read the comment docs.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (67c882b) to head (701d46a).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2709   +/-   ##
=====================================
  Coverage   98.44   98.44           
=====================================
  Files        855     855           
  Lines      12087   12092    +5     
  Branches    3163    3164    +1     
=====================================
+ Hits       11898   11903    +5     
  Misses       185     185           
  Partials       4       4           
Files Coverage Δ
src/shared/api/api.js 98.00% <100.00%> (+0.22%) ⬆️
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <ø> (ø)
Services 99.57% <ø> (ø)
Shared 99.83% <100.00%> (+<0.01%) ⬆️
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67c882b...701d46a. Read the comment docs.

Copy link

codecov bot commented Mar 18, 2024

Bundle Report

Changes will increase total bundle size by 46 bytes ⬆️

Bundle name Size Change
gazebo-production-array-push 5.96MB 46 bytes ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Mar 18, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Commit Created Cloud Enterprise
113e0ba Mon, 18 Mar 2024 13:08:40 GMT Expired Expired
cc47d69 Mon, 18 Mar 2024 13:55:06 GMT Expired Expired
b90839e Mon, 18 Mar 2024 14:20:54 GMT Expired Expired
fdf1a3f Mon, 18 Mar 2024 15:26:01 GMT Expired Expired
956010b Tue, 19 Mar 2024 11:44:23 GMT Expired Expired
9cfa8b7 Fri, 22 Mar 2024 17:17:16 GMT Expired Expired
9cfa8b7 Fri, 22 Mar 2024 17:21:27 GMT Expired Expired
9cfa8b7 Mon, 25 Mar 2024 11:09:17 GMT Expired Expired
e30d8f1 Mon, 25 Mar 2024 12:50:23 GMT Expired Expired
701d46a Thu, 28 Mar 2024 12:41:44 GMT Expired Expired
701d46a Thu, 28 Mar 2024 12:51:05 GMT Cloud Enterprise

Copy link

codecov-public-qa bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (67c882b) 98.43% compared to head (701d46a) 98.43%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2709   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         855      855           
  Lines       12087    12092    +5     
  Branches     3179     3185    +6     
=======================================
+ Hits        11898    11903    +5     
  Misses        185      185           
  Partials        4        4           
Files Coverage Δ
src/shared/api/api.js 98.00% <100.00%> (+0.22%) ⬆️
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <ø> (ø)
Services 99.57% <ø> (ø)
Shared 99.83% <100.00%> (+<0.01%) ⬆️
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67c882b...701d46a. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented Mar 18, 2024

Bundle Report

Changes will increase total bundle size by 46 bytes ⬆️

Bundle name Size Change
gazebo-staging-array-push 5.96MB 46 bytes ⬆️

@RulaKhaled RulaKhaled marked this pull request as ready for review March 25, 2024 11:00
Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be removing the catch. It looks like it was also there to catch other potential rejections that aren't being handled anymore

.catch((err) => {
if (err.status === 401 && config.IS_SELF_HOSTED) {
}).then(async (res) => {
const data = await res.json()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h: What happens if the call to res.json() throws? I believe that was also being handled by the catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, we used to have: if res.ok => res.json(), otherwise throw an error, this was recently changed when i added the catch block.

Comment on lines +96 to +103
if (data?.errors) {
if (
data?.errors?.[0]?.extensions?.status === 403 &&
config.IS_SELF_HOSTED
) {
window.location.href = '/login'
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to double confirm here, users who are logged in, but maybe not have access to something let's say the admin panel in self hosted (which users REST endpoints) won't get redirect to the login page right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, any exceptions handled in REST views must be derived from BaseException, which is not sent with specific extension codes, only messages (they are all handled as 500 server errors). And for what it's worth, we don’t raise 403 anywhere in the REST API

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I totally missed that this change is only occurring in the graphqil method 🤦

@RulaKhaled RulaKhaled merged commit 90ddcba into main Mar 28, 2024
58 checks passed
@RulaKhaled RulaKhaled deleted the round-2-guest-feature branch March 28, 2024 15:55
RulaKhaled added a commit that referenced this pull request Apr 2, 2024
* fix: Handle guest feature error, no nested catch

* Update tests to reflect graphql error

* Fix when to raise an error

* my bad bro

* Update to re add catch block
RulaKhaled added a commit that referenced this pull request Apr 3, 2024
* feat: Create useRepoComponents hook

* We need branch not term

* fix: Handle guest feature error, no nested catch (#2709)

* fix: Handle guest feature error, no nested catch

* Update tests to reflect graphql error

* Fix when to raise an error

* my bad bro

* Update to re add catch block

* build: grab github sha from env (#2672)

Update Sentry deps and bundler plugin config to prepare for incoming fix to source map uploading.

* ref: Convert file entry stuff to ts (#2698)

Part of codecov/engineering-team#588

* chore: Remove bundle analysis flags (#2693)

Remove bundle analysis feature flags from Gazebo.

GH codecov/engineering-team#999
GH codecov/engineering-team#1214

* Prepare release 24.4.1 (#2737)

* Update to use react props with children

---------

Co-authored-by: nicholas-codecov <nicholas.deschenes@sentry.io>
Co-authored-by: Spencer Murray <159931558+spalmurray-codecov@users.noreply.github.com>
Co-authored-by: Codecov Releaser <devops+releaser@codecov.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants