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: better error handling for release with no platforms provided #2264

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

erickzanardo
Copy link
Contributor

Description

Adds a better error handling for the release command when no platforms were provided.

Fixes #2261

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore
  • 🧪 Tests


verify(
() => logger.err(
'At least one platform must be specified.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this all the user sees? Will they know what to do with that or how to specify a platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, that is the only error message that I implemented, open to suggestions on a better message :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eseidel I think they will known what to do as this is probably a often used command and they just did forgot by mistake to add the platforms.

But we could eventually make this message something like:

No platforms were provided, use the --platforms argument to provide one or more platforms

Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @eseidel here—we should endeavor to tell the user how to fix their problems when we can.

Copy link
Contributor

Choose a reason for hiding this comment

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

No platforms were provided, use the --platforms argument to provide one or more platforms

Let's use this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is fair! I've changed, can you take another look please?

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4400b0e) to head (55973b9).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2264   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          186       186           
  Lines         5862      5866    +4     
=========================================
+ Hits          5862      5866    +4     
Flag Coverage Δ
shorebird_cli 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 66 to 68
if (releaseTypeCliNames == null) {
return const [];
}
Copy link
Contributor

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 need this early return. map on an empty list will return an empty list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, but it is not checking on an empty list, it is checking on nullable map, we need an early return.

Either way, your comment made me think and I changed the early return for an elvis operator and a coalesce to empty list directly on the return and I guess it looks better!

@erickzanardo erickzanardo enabled auto-merge (squash) June 18, 2024 18:13
@erickzanardo erickzanardo merged commit c253f63 into main Jun 18, 2024
11 checks passed
@erickzanardo erickzanardo deleted the fix/no-platform-arguments branch June 18, 2024 18:18
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.

fix: shorebird release prints unhelpful error message when no platform is provided.
3 participants