Skip to content

Fix file size too large error and refactor API toast messaging#1202

Open
cj-young wants to merge 9 commits into
ucfopen:devfrom
cj-young:issue/1201-api_toast_refactor
Open

Fix file size too large error and refactor API toast messaging#1202
cj-young wants to merge 9 commits into
ucfopen:devfrom
cj-young:issue/1201-api_toast_refactor

Conversation

@cj-young

@cj-young cj-young commented Jun 11, 2026

Copy link
Copy Markdown

Fixes #1201.

Previously, the logic to display a toast notification was prop-drilled into each component that makes an API call, and a new API instance is created each time. Now, a single API object is used. Also, the logic for displaying a toast has been moved into the App component in the form of a new event listener on the API object.

A 413 option for the toast display function was added to add feedback on "File size too large" errors. Other error status toasts can easily be added later.

In the future, error display shouldn't rely just on status codes since very different errors might have the same status codes but completely different contexts and therefore different intended error messages. A more robust error handling method for API calls should be added. This includes abstracting away response handling (e.g. removing the middleman of response.json() and checking response.ok on every call) and replacing it with API methods that either return the correct result or throw an error.

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