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

Improve commentCreate error message when the pull request can't be found #789

Closed
wants to merge 1 commit into from

Conversation

0x2b3bfa0
Copy link
Member

@0x2b3bfa0 0x2b3bfa0 commented Oct 28, 2021

Part of #606

Before

error: Cannot destructure property 'url' of 'commitPr' as it is undefined.

After

error: PR for commit sha "ff404ff" not found

@0x2b3bfa0 0x2b3bfa0 added bug Something isn't working cml-comment Subcommand ui/ux User interface/experience labels Oct 28, 2021
@0x2b3bfa0 0x2b3bfa0 self-assigned this Oct 28, 2021
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to internal October 28, 2021 22:56 Inactive
@iterative iterative deleted a comment from casperdcl Oct 29, 2021
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to internal October 29, 2021 00:40 Inactive

const [prNumber] = url.split('/').slice(-1);

if (!commitPr || !commitPr.url)
Copy link
Member Author

Choose a reason for hiding this comment

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

Only if merged after #783

Suggested change
if (!commitPr || !commitPr.url)
if (!commitPr?.url)

@0x2b3bfa0 0x2b3bfa0 temporarily deployed to internal October 29, 2021 00:42 Inactive
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to internal October 29, 2021 00:42 Inactive
@0x2b3bfa0 0x2b3bfa0 force-pushed the improve-comment-create-error branch from cf8af36 to b04204f Compare October 29, 2021 00:45
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to internal October 29, 2021 00:45 Inactive
@0x2b3bfa0 0x2b3bfa0 linked an issue Oct 29, 2021 that may be closed by this pull request
Copy link
Contributor

@casperdcl casperdcl left a comment

Choose a reason for hiding this comment

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

fine with merging #783 first :)

@DavidGOrtega
Copy link
Contributor

DavidGOrtega commented Oct 29, 2021

This is ugly. And the error is properly documented. The main reason is the missed destructuring

const { url } = commitPr || {};

@DavidGOrtega
Copy link
Contributor

I closed this one in favour of #791.
#791 can be merged with no particular order to #790

@0x2b3bfa0 0x2b3bfa0 deleted the improve-comment-create-error branch April 3, 2022 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cml-comment Subcommand ui/ux User interface/experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when combining cml pr and cml send-comment --pr
3 participants