Errors API
OmarTawfik opened this issue · comments
Omar Tawfik commented
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 ofDiagnosticKind
, 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.