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

Improvement error message #33

Merged
merged 5 commits into from
Nov 1, 2023
Merged

Conversation

ppputtyo
Copy link
Contributor

スクリーンショット 2023-10-28 17 26 13

概要

  • visitor/以下、validate.rsにおいて発生するエラーの表示をcargo風に変更しました。

例1 (ERRORノードが発生した場合)

input

select * from test from test from test

従来

Unexpected syntax error: visit_select_stmt: ERROR node appeared
Range { start_byte: 9, end_byte: 28, start_point: Point { row: 0, column: 9 }, end_point: Point { row: 0, column: 28 } }

変更後

Unexpected syntax error: visit_select_stmt: ERROR node appeared 
  |
1 | select * from test from test from test
  |          ^^^^^^^^^^^^^^^^^^^ Appears as "ERROR" node on the CST
  |

例2 (フォーマット前とフォーマット後のトークン数が違う場合)

input

seelect * from y

従来

Validation Error: different length. src=2, dst=1

変更後

Validation Error: different kind token: Errors have occurred near the following token
  |
1 | seelect * from y
  |         ^ After format: " (kind: source_file)"
  |

close #32

@ppputtyo ppputtyo marked this pull request as ready for review October 28, 2023 08:38
@ppputtyo ppputtyo requested a review from tanzaku October 28, 2023 08:39
@tanzaku
Copy link
Collaborator

tanzaku commented Nov 1, 2023

LGTM

@tanzaku tanzaku merged commit 2d255b8 into main Nov 1, 2023
8 checks passed
@tanzaku tanzaku deleted the dev_kawabuchi_enhance_errormessages branch November 1, 2023 02:20
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.

Improvement error message
2 participants