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

Errors API #804

Closed
7 tasks
OmarTawfik opened this issue Feb 13, 2024 · 0 comments · Fixed by #963
Closed
7 tasks

Errors API #804

OmarTawfik opened this issue Feb 13, 2024 · 0 comments · Fixed by #963
Assignees

Comments

@OmarTawfik
Copy link
Collaborator

OmarTawfik commented Feb 13, 2024

Instead of an Error type, I suggest moving to Diagnsotic notation, popularized by Roslyn, TypeScript, VS Code, and others.

  • Diagnostic::message() -> String to return a human readable string, usable in editors and downstream APIs.
  • Diagnostic::kind() -> DiagnosticKind to return an enum: ParserError, ValidationError, etc...
  • Diagnostic::code() -> String the string represenatation of DiagnosticKind, suitable to surface in editors and URLs (error glossary/wiki).
  • Diagnostic::severity() -> DiagnosticSeverity to return an enum: Error, Warning, Info, etc... (same as LSP severity levels)
  • Diagnostic::location() for file/range info.

As for the errors API:

  • Remove ariadne reports from the API (should only be the CLI).
  • CLI-specific error codes, and unified representation (like FileNotFound), instead of just panicking.
@OmarTawfik OmarTawfik mentioned this issue Feb 13, 2024
3 tasks
@OmarTawfik OmarTawfik changed the title Typed Errors API Errors API Feb 13, 2024
@OmarTawfik OmarTawfik assigned OmarTawfik and Xanewok and unassigned OmarTawfik Feb 16, 2024
github-merge-queue bot pushed a commit that referenced this issue May 27, 2024
Part of or might close #804 

Rather than coming up with perfect API that ties everything together,
let's start with the `Diagnostic` and iterate from there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants