Skip to content

Conversation

@observerw
Copy link
Contributor

Summary

Fixes issue 3.2 from lsp_test_report_spring_boot.md - Frequent HTTP 500 Internal Server Errors with empty error messages.

Problem

When using the LSP CLI with large Java projects (like Spring Boot), HTTP 500 errors occurred frequently with completely empty error messages (Error: ), leaving users with no information about what went wrong.

Root Cause

  1. Exceptions from the LSP server (especially ExceptionGroup errors) were being caught by a generic handler
  2. The handler simply returned str(exc), which produces unhelpful output for nested exceptions
  3. Error extraction from HTTP 500 responses wasn't pulling detailed information

Changes

Modified Files

  1. src/lsp_cli/manager/client.py - Enhanced the exception handler to:

    • Recursively extract errors from ExceptionGroup
    • Return structured error data with error_type, detail, and request_path
  2. src/lsp_cli/cli/shared.py - Improved error message formatting to:

    • Extract and display error type and endpoint
    • Format as: [ErrorType] at /endpoint: detailed message
    • Handle JSON parsing failures gracefully with specific exception types

Results

Before:

Error: 

After:

Error: [NotFoundError] at /capability/hover: Symbol ['29:14'] not found in /Users/wangbowei/workspace/spring-boot/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/LoadImageUpdateEvent.java

Testing

  • ✅ Tested with Spring Boot project that previously produced empty errors
  • ✅ Verified clear, actionable error messages are now displayed
  • ✅ All linter checks pass
  • ✅ Code formatted with ruff

Impact

Users now receive clear, actionable error messages that explain:

  • What went wrong (error type)
  • Which endpoint failed (request path)
  • Specific details for debugging (detailed message)

- Enhanced exception handler in manager/client.py to extract errors from ExceptionGroup recursively
- Added error_type, detail, and request_path to 500 error responses
- Improved error message formatting in cli/shared.py to display [ErrorType] at /endpoint: message
- Fixed issue where users saw empty error messages on LSP server failures

Resolves issue 3.2 from lsp_test_report_spring_boot.md - Frequent HTTP 500 errors with no error description
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