Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message when credentials are invalid #172

Open
2 tasks
astrojuanlu opened this issue Feb 18, 2025 · 2 comments
Open
2 tasks

Misleading error message when credentials are invalid #172

astrojuanlu opened this issue Feb 18, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@astrojuanlu
Copy link
Member

Description

Image

Context

Steps to Reproduce

Checklist

  • Have you read the "Requirements" section already?
  • Have you make sure you are running the extension with the correct virtual environment? Cmd + P and Python: Select Interpeter

Expected Result

Actual Result

-- If you received an error, place it here.
-- Separate them if you have more than one.

Your Environment

  • Kedro version used (pip show kedro or kedro -V):
  • Kedro VSCode version used
  • Python version used (python -V):
  • Operating system and version:
@astrojuanlu astrojuanlu added the bug Something isn't working label Feb 18, 2025
@noklam
Copy link
Contributor

noklam commented Feb 18, 2025

                        diagnostic = Diagnostic(
                            range=Range(
                                start=Position(line=line_number, character=start_char),
                                end=Position(line=line_number, character=end_char),
                            ),
                            message=f"Dataset '{dataset_name}' has an invalid type '{dataset_type}'. {dataset_exception}",
                            severity=DiagnosticSeverity.Error,
                            source="Kedro LSP",
                        )
                        diagnostics.append(diagnostic)

This seems to be a message we added ourselves. What if we just brings the raw exception?

@astrojuanlu
Copy link
Member Author

I guess you mean

try:
DataCatalog.from_config({dataset_name: clean_dataset_config})
except Exception as dataset_exception:
# Add diagnostic for invalid dataset
line_info = find_line_number_and_character(content, dataset_name, "type")
if line_info:
line_number, start_char = line_info
dataset_type = dataset_config.get("type", "Unknown")
end_char = start_char + len(f"type: {dataset_type}")
diagnostic = Diagnostic(
range=Range(
start=Position(line=line_number, character=start_char),
end=Position(line=line_number, character=end_char),
),
message=f"Dataset '{dataset_name}' has an invalid type '{dataset_type}'. {dataset_exception}",
severity=DiagnosticSeverity.Error,
source="Kedro LSP",
)
diagnostics.append(diagnostic)

I agree, just not making assumptions about the underlying exception should be good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants