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

Enhance error printing and query source span availability #391

Merged
merged 13 commits into from
Jan 30, 2025

Conversation

flyingsilverfin
Copy link
Member

@flyingsilverfin flyingsilverfin commented Jan 28, 2025

Usage and product changes

We improve the error messages to show a ^ column indicator along with --> line indicator:

        define
        attribute name value string;
-->     entity person owns name @range(0..10);
                                ^

We also expose more information about where in the original query spans which sourced various internal data structures.

Implementation

  • Improve error message printing
  • Include further information about Spans throughout TypeQL data structures

@typedb-bot
Copy link
Member

typedb-bot commented Jan 28, 2025

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

  • This change is trivial and does not require a code or architecture review.

Code

  • Packages, classes, and methods have a single domain of responsibility.
  • Packages, classes, and methods are grouped into cohesive and consistent domain model.
  • The code is canonical and the minimum required to achieve the goal.
  • Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
  • Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
  • The code is algorithmically efficient and scalable for the whole application.

Architecture

  • Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
  • Any required build and release automations are updated and/or implemented.
  • Any new components follows a consistent style with respect to the pre-existing codebase.
  • The architecture intuitively reflects the application domain, and is easy to understand.
  • The architecture has a well-defined hierarchy of encapsulated components.
  • The architecture is extensible and scalable.

@flyingsilverfin flyingsilverfin changed the title Make a reusuable query string annotation function Enhance error printing and query source span availability Jan 30, 2025
Comment on lines +84 to +86
"{SYNTAX_ANNOTATED_INDICATOR_LINE}{line_string}\n{}{SYNTAX_ANNOTATED_INDICATOR_COL}",
" ".repeat(SYNTAX_ANNOTATED_INDENT + col)
)
Copy link
Member Author

Choose a reason for hiding this comment

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

We add both the line indicator, and a following like with an ^ column indicator

@flyingsilverfin flyingsilverfin marked this pull request as ready for review January 30, 2025 23:08
@flyingsilverfin flyingsilverfin merged commit 04d6d80 into typedb:3.0 Jan 30, 2025
4 checks passed
@flyingsilverfin flyingsilverfin deleted the annotated-query-ranges branch January 30, 2025 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants