Skip to content

Augment error handling with location information. #249

Open
@Pratyush

Description

@Pratyush

Once 1.46 becomes stable, we should use the #[track_caller] feature to make all errors in this crate more informative following the idea outlined in this playground.

For example, this is how one could modify SynthesisError:

enum ErrorKind {
    AssignmentMissing,
    ...
}

pub struct SynthesisError {
    pub location: &'static Location<'static>,
    pub error: ErrorKind,
}

impl From<ErrorKind> from SynthesisError {
    #[track_caller]
    from(error: ErrorKind>) -> Self {
        let location = caller();
        Self { location, error }
    }
}

This means that we can now track where an error originates, instead of having it show up only when we unwrap().

Metadata

Metadata

Assignees

Labels

D-easyDifficulty: easyT-featureType: new features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions