Skip to content

feat(lsp): custom methods always return errors#4708

Merged
benfdking merged 1 commit intomainfrom
improving_error_handling_in_server
Jun 10, 2025
Merged

feat(lsp): custom methods always return errors#4708
benfdking merged 1 commit intomainfrom
improving_error_handling_in_server

Conversation

@benfdking
Copy link
Copy Markdown
Contributor

No description provided.

@benfdking benfdking force-pushed the improving_error_handling_in_server branch from 32666cd to 1c12e62 Compare June 10, 2025 16:16
@benfdking benfdking force-pushed the improving_error_handling_in_server branch from 1c12e62 to 3147b42 Compare June 10, 2025 17:28
Comment thread sqlmesh/lsp/main.py
return FormatProjectResponse()
except Exception as e:
ls.log_trace(f"Error formatting project: {e}")
return FormatProjectResponse()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we return response on error instead of raising?

Comment thread sqlmesh/lsp/api.py

class ApiResponseGetModels(PydanticModel):
class BaseAPIResponse(CustomMethodResponseBaseClass):
error: t.Optional[str] = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why is error needed here and why is response_error not enough? I wen thought the code but can't understand its purpose of inheriting from CustomMethodResponseBaseClass

@benfdking benfdking merged commit 2c1ed26 into main Jun 10, 2025
25 checks passed
@benfdking benfdking deleted the improving_error_handling_in_server branch June 10, 2025 20:43
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