Skip to content

Conversation

@WillyEverGreen
Copy link

@WillyEverGreen WillyEverGreen commented Dec 10, 2025

Description

This PR addresses a TODO in SaveInterface.js where PDF export errors were previously only logged to the console.

Changes

  • Replaced the TODO comment with a call to this.activity.errorMsg() so PDF export failures are surfaced to the user.
  • Ensured that when the ly2pdf conversion fails, a visible error message is displayed instead of a silent failure.

Testing

  • Verified locally that the error handler is invoked correctly and that normal PDF export behavior remains unchanged.

Copilot AI review requested due to automatic review settings December 10, 2025 19:17
@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

SaveInterface.test.js

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a TODO comment by implementing user-facing error messages for PDF export failures in the Music Blocks application. Previously, when Lilypond to PDF conversion failed, errors were only logged to the console. Now, users receive visible feedback via the error message system.

Key Changes:

  • Replaced TODO comment with this.activity.errorMsg() call to display PDF generation errors to users
  • Improved code formatting consistency with multi-line string concatenations and standardized arrow function syntax
  • Fixed JSDoc comment indentation for better readability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// eslint-disable-next-line no-console
console.debug("Error: " + dataurl);
//TODO: Error message box
this.activity.errorMsg(_("Error generating PDF") + ": " + dataurl);
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The error message exposes technical details (the raw dataurl error message) to end users, which may be confusing or unhelpful. Consider providing a more user-friendly error message that doesn't include the technical details, or at least truncate/sanitize the dataurl value before displaying it. For example, the dataurl could be a lengthy data URI or contain technical error information that isn't meaningful to users.

Suggested change
this.activity.errorMsg(_("Error generating PDF") + ": " + dataurl);
this.activity.errorMsg(_("Error generating PDF"));

Copilot uses AI. Check for mistakes.
// eslint-disable-next-line no-console
console.debug("Error: " + dataurl);
//TODO: Error message box
this.activity.errorMsg(_("Error generating PDF") + ": " + dataurl);
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The test for the afterSaveLilypondPDF error case (line 702-718 in SaveInterface.test.js) should be updated to verify that activity.errorMsg is called with the expected error message. Currently, the test only checks that console.debug is called, but the new implementation also displays an error message to the user via errorMsg.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@WillyEverGreen
Copy link
Author

@walterbender Hi! Just a gentle ping 😊
All tests are passing and the PR is ready for review.
Whenever you get time, could you please take a look?
Thanks!

@walterbender
Copy link
Member

Maybe you can sort out the conflicts...

@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

SaveInterface.test.js

Replace TODO comment with call to this.activity.errorMsg() so PDF export

failures are surfaced to the user instead of only being logged to console.
@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

SaveInterface.test.js

@WillyEverGreen
Copy link
Author

@walterbender I’ve rebased the branch onto the latest master and addressed the conflicts you mentioned.
The latest commit has green Jest checks.
Please let me know if you’re still seeing anything on your side.

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.

2 participants