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

show error message in replay command when no logs available #5292

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jacobsteves
Copy link
Member

WHY are these changes introduced?

Fixes https://github.com/Shopify/shopify-functions/issues/599

If someone tries to run the function replay command without having any logs existing, they get an ugly error message:
image

WHAT is this pull request doing?

Make that error nicer! If they directory doesn't exist, we can assume theres no logs. We already have nice error handling when theres no logs, but the directory exists.

How to test your changes?

  1. Blow away your logs folder. For me, this was: rm -rf ~Library/Logs/shopify-cli-nodejs
  2. Run pnpm shopify app function replay --path path_to_your_app
  3. Check the error, its now more readable
image

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes. None needed.

Copy link
Contributor

github-actions bot commented Jan 28, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.47% (+0.02% 🔼)
8968/11883
🟡 Branches
70.67% (+0.06% 🔼)
4369/6182
🟡 Functions
75.3% (+0.01% 🔼)
2354/3126
🟡 Lines
75.97% (+0.02% 🔼)
8471/11151

Test suite run success

2025 tests passing in 907 suites.

Report generated by 🧪jest coverage report action from 61a1a10

@jacobsteves jacobsteves marked this pull request as ready for review January 28, 2025 14:54
@jacobsteves jacobsteves requested review from a team as code owners January 28, 2025 14:54
@jacobsteves jacobsteves requested review from a team, lopert and mssalemi and removed request for a team January 28, 2025 14:56
@jacobsteves jacobsteves force-pushed the js.show-error-message-when-no-logs-available branch 2 times, most recently from fde6c46 to 714dbeb Compare January 28, 2025 15:13
Copy link
Contributor

@mssalemi mssalemi left a comment

Choose a reason for hiding this comment

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

🎩 LGTM. Code make sense to me using existsSync to check before.

@jacobsteves jacobsteves force-pushed the js.show-error-message-when-no-logs-available branch from 714dbeb to 61a1a10 Compare January 29, 2025 14:06
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.

4 participants