-
Notifications
You must be signed in to change notification settings - Fork 4
feat(authz): [FC-0099] create an custom error boundery #11
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
Conversation
|
Thanks for the pull request, @dcoa! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11 +/- ##
==========================================
+ Coverage 92.29% 92.44% +0.15%
==========================================
Files 31 33 +2
Lines 454 503 +49
Branches 77 80 +3
==========================================
+ Hits 419 465 +46
- Misses 34 37 +3
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
arbrandes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though I did have one nit.
| resetErrorBoundary(); | ||
| }; | ||
| return ( | ||
| <Container className="d-flex flex-column align-items-center justify-content-center min-vh-100 bg-light-200" data-testid="error-page"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <Container className="d-flex flex-column align-items-center justify-content-center min-vh-100 bg-light-200" data-testid="error-page"> | |
| <Container className="d-flex flex-column align-items-center justify-content-center min-vh-100 bg-light-200"> |
Do you foresee a need to use getByTestId? If not, I'd rather we only add it if necessary (for the usual reasons).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tested on my local yet, but overall it looks good. I have added a couple of comments with some suggestions let me know your thoughts. Nice work!
| </ErrorBoundary>, | ||
| ); | ||
| const reloadBtn = screen.getByText(/Reload Page/i); | ||
| fireEvent.click(reloadBtn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be interesting to use userEvent instead of fireEvent to handle user interactions since it simulates a full user interaction, rather than just a single event, leading to more realistic and robust tests https://testing-library.com/docs/user-event/intro/
| }); | ||
| }; | ||
|
|
||
| const librariesUrl = () => `${getConfig().AUTHORING_BASE_URL}/authoring/libraries`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not getting why this one is a function and not just a constant.
| const librariesUrl = () => `${getConfig().AUTHORING_BASE_URL}/authoring/libraries`; | |
| const LIBRARIES_URL = `${getConfig().AUTHORING_BASE_URL}/authoring/libraries`; |
And maybe it can be moved to the constants file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why is a function is because as a constant the code return undefined
Because this is the only component that uses the url I left it here, I will put the variable directly in the destination prop instead, like this https://github.com/openedx/frontend-app-account/blob/c7bbe8d0d1f08e00595bcb6de4f032b2c8c1d6bb/src/id-verification/panels/SummaryPanel.jsx#L54
| } = getErrorConfig({ errorMessage, errorStatus }); | ||
|
|
||
| const handleReload = () => { | ||
| if (reloading) { return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line maybe not needed since the button is disabled when reloading is true.
30bdcf7 to
670aa28
Compare
|
@jacobo-dominguez-wgu @arbrandes I addressed your comments, and I just change the env variable to |
|
@dcoa Thanks for addressing my suggestions. I tested it on the sandbox you provided and this is what I found
|
The reason why that is happening is that the authZ API that is the initial evaluation (if I have permission or not) is not validating if a scope exist or not, instead it returns 400 if you put something random because the scope is not properly formatted (I can treat this ones as not found from the front), or not allowed permissions if the format is correct but the library (scope) does not exist.
Yes, there is a issue about how the env was defined in the sandbox |
670aa28 to
03fcc19
Compare


Create a custom error boundary for libraries team management workflow
This PR creates a custom error boundary that maps errors
401/403/404/5xxChanges overview
Evidence