Skip to content

refactor: Create withModalOnError helper function#2129

Merged
marcustyphoon merged 5 commits intomasterfrom
marcustyphoon/catch-helper
Mar 12, 2026
Merged

refactor: Create withModalOnError helper function#2129
marcustyphoon merged 5 commits intomasterfrom
marcustyphoon/catch-helper

Conversation

@marcustyphoon
Copy link
Collaborator

@marcustyphoon marcustyphoon commented Mar 2, 2026

Description

This creates a withErrorModal helper function that wraps a given function in showErrorModal to catch errors when it's executed. I find this more clear than writing e.g. event => onButtonClicked(event).catch(showErrorModal). My guess is that this is probably uncontroversial?

Question is, would we want to write withErrorModal(someCallback) in the place where it's used, as I did here, or around someCallback where it's defined? The latter breaks jsdoc.

(cherry-picked from #2126)

Testing steps

Confirm that Mass Privater, Tag Replacer, and Trim Reblogs show error messages when attempting to use them with no network connection.

@marcustyphoon marcustyphoon requested a review from AprilSylph March 2, 2026 10:25
Copy link
Owner

@AprilSylph AprilSylph left a comment

Choose a reason for hiding this comment

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

I think I would call this withModalOnError for maximum clarity. Otherwise LGTM.

...uh, and 498573a might be worth dropping. #1639 isn't exactly in active review.

marcustyphoon and others added 2 commits March 12, 2026 06:34
Co-Authored-By: April Sylph <28949509+AprilSylph@users.noreply.github.com>
@marcustyphoon marcustyphoon changed the title refactor: Create withErrorModal helper function refactor: Create withModalOnError helper function Mar 12, 2026
@marcustyphoon marcustyphoon merged commit ea2944f into master Mar 12, 2026
5 checks passed
@marcustyphoon marcustyphoon deleted the marcustyphoon/catch-helper branch March 12, 2026 13:36
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