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

Rework error structs and implementation #454

Open
6 tasks
JSAbrahams opened this issue Jan 25, 2023 · 0 comments
Open
6 tasks

Rework error structs and implementation #454

JSAbrahams opened this issue Jan 25, 2023 · 0 comments
Labels
code quality: general Code quality issue not relevant to a particular module

Comments

@JSAbrahams
Copy link
Owner

JSAbrahams commented Jan 25, 2023

Summary of current issue

Error implementation could be made more elegant:

  • Cause is an unnecessary construct I think.
    Why not just point to another relevant error?
    So we just get a linked list.
  • All relevant error constructs should implement error, so they behave like any other error in Rust, making it easier to use the library.
    We can use the thiserror crate

Proposed change

  • Remove Cause struct.
    • Change WithCause trait to WithErr<T>, for relevant errors
  • Make ParseErr and LexErr derive Error
  • Make TypeErr and derive Error
    • Introduce new TypeErr struct which has internal vector of TypeErrs
      Let this struct also derive Error.
      If we add a new method which behaves similar to the new of TypeErr, we can use this in all situations where we have to manually construct a vector of errors.
  • Make UnimplementedErr derive Error
@JSAbrahams JSAbrahams added the code quality: general Code quality issue not relevant to a particular module label Jan 25, 2023
@JSAbrahams JSAbrahams added this to the v0.3.7 | Type alias milestone Jan 25, 2023
@JSAbrahams JSAbrahams changed the title Should rework error Rework error structs and implementation Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality: general Code quality issue not relevant to a particular module
Projects
None yet
Development

No branches or pull requests

1 participant