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

Refactor Error Types #24

Merged
merged 19 commits into from
Mar 26, 2024
Merged

Conversation

willbush
Copy link
Member

@willbush willbush commented Mar 22, 2024

Work related to: #2

This pull request does not change the single-line vs multi-line style or any of the error messages. The goal here is to reduce code duplication.

A lot of the NixpkgsProblem enum variants had common fields more or less due to the context of where the error originated.

I grouped these similar problems into structs which contains the common fields and a kind enum to differentiate between the different types of problems.

It can be derived from the package_name
to avoid confusing it with a valid package_name where relative_package_dir could
be derived.
@willbush willbush marked this pull request as draft March 22, 2024 04:48
@willbush willbush marked this pull request as ready for review March 24, 2024 02:04
@willbush willbush changed the title Consistent errors Refactor Error Types Mar 24, 2024
@willbush
Copy link
Member Author

I'm not able to add reviewers @infinisil @philiptaron :)

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial thoughts. I like the direction.

src/eval.rs Outdated Show resolved Hide resolved
src/eval.rs Outdated Show resolved Hide resolved
src/nixpkgs_problem.rs Outdated Show resolved Hide resolved
src/nixpkgs_problem.rs Show resolved Hide resolved
src/ratchet.rs Outdated Show resolved Hide resolved
src/references.rs Outdated Show resolved Hide resolved
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed together in today's office hour with @willbush and @philiptaron

Got some minor suggestions, overall looking good.

One other thing is to add simple comments to the new types.

src/nixpkgs_problem.rs Outdated Show resolved Hide resolved
src/nixpkgs_problem.rs Outdated Show resolved Hide resolved
src/references.rs Outdated Show resolved Hide resolved
src/eval.rs Outdated Show resolved Hide resolved
@willbush willbush requested a review from a team as a code owner March 26, 2024 01:40
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looking good to me!

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some curiosities.

src/eval.rs Show resolved Hide resolved
@philiptaron philiptaron merged commit 53f206e into NixOS:main Mar 26, 2024
1 check passed
@infinisil infinisil mentioned this pull request Apr 8, 2024
@willbush willbush deleted the by-name-consistent-errors branch May 19, 2024 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants