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

Unified errors #495

Merged
merged 10 commits into from
May 4, 2023
Merged

Unified errors #495

merged 10 commits into from
May 4, 2023

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented May 4, 2023

This unifies the error hierarchy for compilation under rune::compile, which simplifies a bunch of code.

Also introduces a public WithSpan trait, that can be used by macro authors to attach a custom span to an error of their choosing.

With this, a complete compiler error translated from something like an Option::None can be written as:

use rune::compile::WithSpan;

let value = option.ok_or("missing thing").with_span(span)?;

@udoprog udoprog added the enhancement New feature or request label May 4, 2023
@udoprog udoprog merged commit 6cd6907 into main May 4, 2023
@udoprog udoprog deleted the unified-errors branch May 4, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant