Skip to content

Displayed an error message when the export modal PDF or ICS download fails - #1847

Merged
david-yz-liu merged 3 commits into
Courseography:masterfrom
danielrafailov:show-export-download-errors
Dec 2, 2026
Merged

david-yz-liu merged 3 commits into
Courseography:masterfrom
danielrafailov:show-export-download-errors

Conversation

@danielrafailov

@danielrafailov danielrafailov commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

Follow-up to #1841, as requested there. When the PDF or ICS download in the Export modal fails, the user gets no feedback. The error callbacks in getPDF and getCalendar only throw "No pdf generated" / throw "No calendar avaiable". That throw happens inside a jQuery callback, so nothing catches it: the error only shows up in the browser console, and clicking the link appears to do nothing.

Changes:

  • export.tsx:
    • ExportModal now tracks a pdfError and a calendarError state, separate from each other and from the image error added in Displayed an error message when the export modal image fails to load #1841. If the /timetable-pdf or /calendar request fails, it sets a message ("The PDF could not be generated. Please try again." or "The calendar file could not be generated. Please try again."), and the throw is removed. A successful download clears only that download's message, and reopening the modal clears both.
    • getPDF and getCalendar now take a callback for setting their error, so the download links call them through an arrow function (onClick={() => getPDF(setPdfError)}).
    • Each message is shown directly under the link it belongs to. Because the errors are separate, a failed download doesn't remove the preview image, and if the image and both downloads fail, all three messages are shown.
    • Renamed the ImageError component to ExportError, since it now shows both kinds of error.
  • app.scss: renamed the .export-image-error class to .export-error to match. The style itself is unchanged.
  • Tests: added tests to ExportModal.test.js checking that:
    • a failed PDF download (graph and grid pages) and a failed ICS download show the error message and keep the preview image
    • each message is shown under its own link
    • all three messages appear when the image and both downloads fail
    • a successful download clears only its own message
    • reopening the modal clears the download messages
Screenshots of your changes (if applicable)

Export modal (Graph), failed PDF download, before the change:
Screenshot 2026-11-29 at 3 17 55 PM
Export modal (Graph), failed PDF download, after the change:
Screenshot 2026-11-29 at 3 19 00 PM
Export modal (Grid), failed ICS download, before the change:
Screenshot 2026-11-29 at 3 24 43 PM
Export modal (Grid), failed ICS download, after the change:
Screenshot 2026-11-29 at 3 21 21 PM
Export modal (Grid), failed PDF download, after the change:
Screenshot 2026-11-29 at 3 22 25 PM
Export modal (Grid), image and both downloads failing, after the change:
Screenshot 2026-11-29 at 3 23 41 PM

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue) X
🎨 User interface change (change to user interface; provide screenshots) X
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.
  • I have updated the project Changelog (this is required for all changes).

After opening your pull request:

  • I have verified that the CI checks have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

  • To trigger the errors for the screenshots, I blocked the /timetable-pdf and /calendar requests in Chrome DevTools (Network → right-click the request → Block request URL).
  • GraphImage and GridImage now render the whole contents of the export modal (header, download links, error messages, preview and the Switch Sessions button), not just the image. I left them alone to keep this PR focused, but I can rename them (e.g. to GraphExportContent and GridExportContent) in a follow-up if you'd like.

danielrafailov and others added 2 commits November 29, 2026 12:59
…fails

The error callbacks in getPDF and getCalendar threw inside a jQuery
callback, so a failed download gave the user no feedback. They now set
a download error that the export modal shows under the download links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

coveralls commented Nov 29, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 46304962838

Coverage increased (+0.7%) to 63.047%

Details

  • Coverage increased (+0.7%) from the base build.
  • Patch coverage: 11 of 11 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4336
Covered Lines: 2780
Line Coverage: 64.11%
Relevant Branches: 1014
Covered Branches: 593
Branch Coverage: 58.48%
Branches in Coverage %: Yes
Coverage Strength: 146.85 hits per line

💛 - Coveralls

@danielrafailov
danielrafailov requested a balanced review from Copilot November 29, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, @danielrafailov!

@david-yz-liu
david-yz-liu merged commit 5b62d4e into Courseography:master Dec 2, 2026
3 checks passed
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