Skip to content

feat(image): inline upload-error feedback parity with FontManager#43

Merged
u8array merged 1 commit into
mainfrom
chore/image-upload-error-feedback
May 10, 2026
Merged

feat(image): inline upload-error feedback parity with FontManager#43
u8array merged 1 commit into
mainfrom
chore/image-upload-error-feedback

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 10, 2026

The image upload handler had try/finally without catch, so failures (non-image MIME, oversize, decode error, GFA exception) propagated as unhandled rejections with no user signal. Add uploadFailed state and a small inline hint matching FontManager's pattern.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements error handling for image uploads in the image registry component, adding an 'uploadError' translation key across all supported locales. The image component now tracks an 'uploadFailed' state and displays an inline error message if image loading or conversion fails. Feedback was provided to explicitly log caught errors to the console to assist with debugging, as the current implementation suppresses them despite the code comments suggesting they would be visible.

Comment thread src/registry/image.tsx
Comment on lines +103 to +108
} catch {
// loadImageFile rejects on non-image MIME, oversized files, decode
// failures; imageToGFA can also throw. Surface a single inline hint
// (mirrors FontManager) — the underlying error is already in the
// console for debugging.
setUploadFailed(true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The comment mentions that the error is already in the console, but catching it without re-throwing or logging it actually prevents it from appearing there (as it is no longer an unhandled rejection). It is best to explicitly log the error to aid in debugging issues like invalid image formats or conversion failures.

      } catch (err) {
        // loadImageFile rejects on non-image MIME, oversized files, decode
        // failures; imageToGFA can also throw. Surface a single inline hint
        // (mirrors FontManager) — we log the error to the console for debugging.
        console.error(err);
        setUploadFailed(true);
      }

The image upload handler had `try/finally` without `catch`, so failures
(non-image MIME, oversize, decode error, GFA exception) propagated as
unhandled rejections with no user signal. Add `uploadFailed` state and a
small inline hint matching FontManager's pattern. Catch swallows the
underlying error intentionally — codebase has no production logging
convention; specific causes are debugged with a devtools breakpoint.
@u8array u8array force-pushed the chore/image-upload-error-feedback branch from 637ff81 to 9178895 Compare May 10, 2026 06:39
@u8array u8array merged commit 7c3caf8 into main May 10, 2026
2 checks passed
@u8array u8array deleted the chore/image-upload-error-feedback branch May 10, 2026 20: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.

1 participant