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

enhance error handling with thiserror #1447

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

CormickKneey
Copy link
Contributor

Relevant Issue (if applicable)

close issue

Details

use thiserror in ApiError and RafsError. Also some changes in nydusError.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • make successfully

@CormickKneey CormickKneey requested a review from a team as a code owner October 20, 2023 03:43
@CormickKneey CormickKneey requested review from jiangliu, gaius-qi and adamqqqplay and removed request for a team October 20, 2023 03:43
Copy link
Member

@adamqqqplay adamqqqplay left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

BTW, you can use "git commit --amend -s" to sign this commit to pass the CI.

@CormickKneey CormickKneey force-pushed the 202310_dev branch 2 times, most recently from fbf754d to b3d8f95 Compare October 20, 2023 14:23
Signed-off-by: linchuan <linchuan.jh@antgroup.com>
@CormickKneey
Copy link
Contributor Author

It seems that there might be an issue with the aci pipeline. Could u help take a look or let me know if there is anything else I need to do?

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #1447 (c3fc5cf) into master (5c63ba9) will decrease coverage by 0.02%.
Report is 2 commits behind head on master.
The diff coverage is 15.62%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1447      +/-   ##
==========================================
- Coverage   46.29%   46.27%   -0.02%     
==========================================
  Files         123      123              
  Lines       38872    38869       -3     
  Branches    38872    38869       -3     
==========================================
- Hits        17995    17987       -8     
- Misses      19906    19909       +3     
- Partials      971      973       +2     
Files Coverage Δ
service/src/lib.rs 78.66% <ø> (+3.02%) ⬆️
rafs/src/fs.rs 18.64% <0.00%> (ø)
rafs/src/lib.rs 64.24% <0.00%> (+2.25%) ⬆️
rafs/src/metadata/mod.rs 52.49% <0.00%> (ø)
utils/src/trace.rs 77.31% <0.00%> (-2.07%) ⬇️
api/src/error.rs 67.74% <33.33%> (ø)
api/src/http.rs 0.00% <0.00%> (ø)
storage/src/backend/registry.rs 32.16% <17.39%> (-0.78%) ⬇️

... and 2 files with indirect coverage changes

@imeoer
Copy link
Collaborator

imeoer commented Oct 24, 2023

@CormickKneey The codecov CI should be fixed, let's move forward (the failed codecov/patch can be ignored).

Copy link
Member

@adamqqqplay adamqqqplay left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@@ -14,6 +14,7 @@ log = "0.4.8"
serde_json = "1.0.53"
toml = "0.5"

thiserror = "1.0.30"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move it to line 15.

@@ -51,8 +52,9 @@ pub enum TraceClass {
}
}

#[derive(Debug)]
#[derive(Error, Debug)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about using #[derive(thiserror::Error, Debug)], it's more informative.

@imeoer
Copy link
Collaborator

imeoer commented Oct 26, 2023

Thanks for the PR! The target of using thiserror & andhow is to remove the api/src/error.rs file.
Any subsequent PRs will be submitted?

@CormickKneey
Copy link
Contributor Author

Thanks for the PR! The target of using thiserror & andhow is to remove the api/src/error.rs file. Any subsequent PRs will be submitted?

Ah, I didn't notice the macro rules in the api/src/error.rs earlier. But I took a quick look, and I'm not quite ready to smoothly switch those content to thiserror yet. Maybe I'll complete this task in the next time. 👿

@jiangliu jiangliu merged commit 6dc9144 into dragonflyoss:master Oct 27, 2023
23 of 24 checks passed
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.

Use thiserror crate to simply errors across the repo
4 participants