fix: list supported methods in unknown method errors#2910
Open
srpatcha wants to merge 1 commit into
Open
Conversation
The consolidated method-dispatch tools returned a bare "unknown method: <value>" without listing valid methods, unlike labels.go which already says "Supported methods are: ...". Make the error messages consistent across all method-dispatch tools by appending the list of supported methods: - issue_read, sub-issue write (issues.go) - sub-issue read/write (issue_dependencies.go) - ui_get (ui_tools.go) - pull_request_read, pull_request_review_write (pullrequests.go) - projects list/get/write (projects.go) - actions list/get/run (actions.go) Additionally, pull_request_review_write decoded arguments with mapstructure.WeakDecode and did not validate that method was provided, so an omitted method produced a confusing "unknown method: " (empty value). Add an explicit check that reports "missing required parameter: method" with the supported methods. Fixes github#2712 Signed-off-by: Srikanth Patchava <srpatcha@users.noreply.github.com>
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
Fixes #2712
The consolidated method-dispatch tools returned a bare
unknown method: <value>without listing valid methods, unlikelabels.gowhich already saysSupported methods are: create, update, delete. This makes the behavior inconsistent and unhelpful for callers.Changes
Appended the list of supported methods to every
unknown methoderror across the method-dispatch tools:issues.goissue_read, sub-issue writeissue_dependencies.goui_tools.goui_getpullrequests.gopull_request_read,pull_request_review_writeprojects.goactions.goAdditionally,
pull_request_review_writeusedmapstructure.WeakDecodeand did not validate thatmethodwas provided, so omitting it produced a confusingunknown method:(empty value) — which reads like a routing bug rather than a missing argument. Added an explicit check:Testing
All existing tests that assert on
unknown methoduseassert.Contains, so the appended text preserves the existing substring matches — no test changes required. The new error messages are strict supersets of the previous ones.