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

GH-318/fix create issue display error showing as JSON #333

Merged

Conversation

aidapira
Copy link
Contributor

Summary

The Create Issue error display showed as JSON and this ticket fixes it to display the message instead.

Ticket Link

#318

@aidapira aidapira requested a review from hanzei as a code owner July 22, 2020 23:45
@hanzei hanzei linked an issue Jul 23, 2020 that may be closed by this pull request
@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Jul 23, 2020
Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the quick contribution 👍

@hanzei hanzei requested a review from larkox July 23, 2020 09:23
Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks! 🎉

@larkox larkox removed the 2: Dev Review Requires review by a core committer label Jul 23, 2020
@larkox larkox requested a review from DHaussermann July 23, 2020 11:53
@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2020

Codecov Report

Merging #333 (09f8181) into master (eda6f9a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #333   +/-   ##
=======================================
  Coverage   19.35%   19.35%           
=======================================
  Files          11       11           
  Lines        2770     2770           
=======================================
  Hits          536      536           
  Misses       2196     2196           
  Partials       38       38           

Continue to review full report at Codecov.

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

@aidapira
Copy link
Contributor Author

Thanks @hanzei, @larkox, and @mickmister for reviewing this PR. This PR is a quick resolution for this issue, however, I believe that it will still need to be further examined and the changes from stringified error to parseable object error should happen in the function that receives the error, not in the method that renders it. Therefore, I believe that still needs to change for this issue to be complete, either in this PR, or if further consistency between error objects across the webapp and the server need to be examined then possibly in the scope of another issue.

@mickmister
Copy link
Member

Therefore, I believe that still needs to change for this issue to be complete, either in this PR, or if further consistency between error objects across the webapp and the server need to be examined then possibly in the scope of another issue.

This fix seems fine for the scope of this ticket. Created a follow up ticket to address the broader issue #337

@@ -124,7 +124,7 @@ export default class CreateIssueModal extends PureComponent {
if (error) {
submitError = (
<p className='help-text error-text'>
<span>{error}</span>
<span>{JSON.parse(error).message}</span>
Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned that error may sometimes be a string here. Maybe we should protect against that?

Copy link
Member

Choose a reason for hiding this comment

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

If it is the case that error is a string, then this will error out and cause WSOD. I suggest applying a fix in this component's handleCreate method instead of the render function, similar to the fix in the Attach Comment to Issue Modal:

let errMessage = created.error.message;
if (created.error.response &&
created.error.response.body &&
created.error.response.body.message) {
errMessage = created.error.response.body.message;
}

Copy link
Member

Choose a reason for hiding this comment

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

@aidapira What are your thoughts on moving the fix out of the render function and into handleCreate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @mickmister, that sounds like a great idea. Please give me a few days and I will commit the updates based on your comment.

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Reproduce this by attempting to create an issue in a repository where issue creation has been disabled
  • Applied this PR and the json error is now replaced with friendlier failed to create issue: Unknown status code 410
  • Briefly regression tested the modal
    LGTM!

Thanks @aidapira for this enhancement! Much appreciated.

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Aug 3, 2020
@hanzei hanzei added this to the v1.1.0 milestone Aug 3, 2020
@mickmister mickmister added the Awaiting Submitter Action Blocked on the author label Aug 5, 2020
@hanzei hanzei added 2: Dev Review Requires review by a core committer and removed 4: Reviews Complete All reviewers have approved the pull request labels Aug 5, 2020
@hanzei hanzei modified the milestones: v1.1.0, v1.2.0 Aug 6, 2020
@mattermod
Copy link
Contributor

This issue has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @hanzei

@hanzei
Copy link
Contributor

hanzei commented Aug 17, 2020

@aidapira Do you have questions about the feedback above? #333 (comment) Let me know if you need any help.

@aidapira
Copy link
Contributor Author

@aidapira Do you have questions about the feedback above? #333 (comment) Let me know if you need any help.

@hanzei Thank you so much for pointing my attention to @mickmister's comment. I will let you know after I give it a try!

@hanzei
Copy link
Contributor

hanzei commented Aug 18, 2020

@aidapira Awesome, looking forward to your response 👍

@hanzei
Copy link
Contributor

hanzei commented Sep 28, 2020

@aidapira Thanks for updating the PR 👍 Heads up that there is a merge conflict to resolve.

@hanzei hanzei added the Awaiting Submitter Action Blocked on the author label Oct 5, 2020
Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks @aidapira! Looks good, I just have two last requests

@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich

@jfrerich
Copy link
Contributor

jfrerich commented Oct 26, 2020

Hi @aidapira! It seems that you are really close to completing this PR. Do you need any further assistance from one of our developers? There is also a merge conflict that will need to be addressed.

@hanzei
Copy link
Contributor

hanzei commented Mar 16, 2021

@aidapira Are you planing to continue working on this PR?
Please note that we will close this PR after another 10 days of inactivity. If you don't object, other contributors might complete this PR for you.

@hanzei hanzei added Lifecycle/2:inactive and removed 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Mar 16, 2021
@aidapira
Copy link
Contributor Author

@aidapira Are you planing to continue working on this PR?
Please note that we will close this PR after another 10 days of inactivity. If you don't object, other contributors might complete this PR for you.

Hi @hanzei, thanks for mentioning me and giving me some time to complete this PR. I'm working on completing it now and would expect an update within the next week.

Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks @aidapira!

@mickmister
Copy link
Member

@aidapira It looks like there are some conflicts with one of the files. Are you able to resolve the conflicts with master?

@hanzei hanzei removed their request for review March 29, 2021 11:50
@mickmister
Copy link
Member

Hi @aidapira, it looks like there is one remaining linting error here:

/home/circleci/project/webapp/src/components/modals/create_issue/create_issue.jsx
  91:34  error  Missing trailing comma  comma-dangle

@mickmister mickmister removed the Awaiting Submitter Action Blocked on the author label May 18, 2021
Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @aidapira!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The error message display in the Create Issue modal displays as JSON
9 participants