Skip to content

Rework error structs and implementation #454

Description

@JSAbrahams

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code quality: generalCode quality issue not relevant to a particular module

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions