fix: improve CardActionHandler type safety and error handling - #208
Open
dajiaohuang wants to merge 1 commit into
Open
fix: improve CardActionHandler type safety and error handling#208dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
- Replace generic Function type with explicit (data: any) => Promise<any> signature - Re-throw caught errors instead of returning undefined, allowing callers to distinguish success from failure
dajiaohuang
force-pushed
the
fix/card-handler-improvements
branch
from
August 24, 2026 14:43
ed8f464 to
765ddc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the CardActionHandler in dispatcher/card.ts:
Changes
Type Safety: Changed
Functiontype to specific signature(data: any) => Promise<any>for:cardHandlerpropertyhandlesMap valuesregistermethod parameterError Handling: Changed error handling to re-throw exceptions instead of silently swallowing them:
catch (e)now doesthrow einstead ofreturn undefinedWhy
Functiontype is too broad and loses type safety