Skip to content

fix(web): Handle image loading failures in laptop screen generator #95

Closed

Description

@jamro

Problem

The laptop screen generator handles successful image loading through img.onload, but does not handle img.onerror.

When a user selects a corrupted or unsupported image, the UI does not report the loading failure. If a valid image was previously loaded, it remains active, potentially causing the user to download a PDF containing the wrong image.

Location

web/js/screens.js — loadImage()

Introduced in PR #88.

Expected behavior

  • Display a clear error message when an image fails to load.
  • Avoid silently using a previously loaded image.
  • Keep the UI state consistent with the selected file.
  • Allow users to retry with another image.

Acceptance criteria

  • Handle image decoding/loading failures using img.onerror.
  • Display an actionable error message.
  • Ensure the preview and PDF download cannot silently use the wrong image.
  • Verify behavior when loading an invalid image after a valid one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions