Skip to content

Conversation

@danhellem
Copy link
Contributor

@danhellem danhellem commented Nov 13, 2025

This pull request improves error handling in the configureWorkItemTools function within src/tools/work-items.ts by wrapping all handler logic in try/catch blocks and returning structured error responses instead of throwing exceptions. Additionally, related tests in test/src/tools/work-items.test.ts have been updated to expect these new error response formats. This change ensures more consistent and user-friendly error reporting across all work item operations.

Error handling improvements:

Test updates:

  • Updated tests in test/src/tools/work-items.test.ts to check for the new error response structure, verifying that isError is true and that error messages are included in the response content. [1] [2]

GitHub issue number

#703

Associated Risks

N/A

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

Added new tests and manual tested

@danhellem danhellem requested a review from a team as a code owner November 13, 2025 16:53
@github-actions
Copy link

github-actions bot commented Nov 13, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

return {
content: [{ type: "text", text: JSON.stringify(backlogs, null, 2) }],
};
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider introducing a utility method that does the try-catch and takes a handler and error message, this could be re-used for all of these tools instead of explicitly adding a try-catch in each tool

@danhellem danhellem merged commit 5f7071a into main Nov 13, 2025
7 checks passed
@danhellem danhellem deleted the danhellem-wit-improve-error-handling-1 branch November 13, 2025 20:23
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.

Go thru tools to ensure we are properly handling errors and 500 response codes

4 participants