Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve error messages #188

Open
lenguyenthanh opened this issue Jul 12, 2022 · 2 comments
Open

Improve error messages #188

lenguyenthanh opened this issue Jul 12, 2022 · 2 comments

Comments

@lenguyenthanh
Copy link
Member

Error messages should tell where and why error happen

@nvduc91
Copy link

nvduc91 commented Dec 3, 2022

I saw we using NoStackTrace therefor no stacktrace provided?
And we could define some rules to present errors. Could be some point like:

  • Should we provide stacktrace? if yes, full of it or parts of it?
  • rules to presenting the errors if needed (custom before show up/make it shorter ...)
  • impl and add tests for it.

@lenguyenthanh
Copy link
Member Author

* Should we provide stacktrace? if yes, full of it or parts of it?

We use Error as data so we don't need stacktrace.

* rules to presenting the errors if needed (custom before show up/make it shorter ...)

Error Messages should be able to tell where (e.g. line 8 column 9) and why (e.g. "Operands must be numbers.").

So we'll need a new data structure to present data. Probably something like this:

case class ErrorMessage(
  val location: Span,
  val message: String)
)

Our problem is ParserError doesn't have location on it, so we have to fix that first.

For inspiration Rust diagnostic code: https://github.com/rust-lang/rust/blob/4e82f35492ea5c78e19609bf4468f0a686d9a756/compiler/rustc_errors/src/json.rs#L185

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants