-
Notifications
You must be signed in to change notification settings - Fork 19
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
Do we have a guideline for handling error? #27
Comments
There’s no guideline per se at the moment, but generally what you want to do is implement a type that derives |
I see. Thank you for your reply. I can understand now. I think a simple tutorial will be quite helpful for new contributors. |
I'll leave this issue open. When a consistent error handling method and guideline is ready, we can close this issue then. |
I mean the method is generally pretty consistent (I don’t think it’s possible to make the setup fully general as the utilities have widely different errors) except for a few strange situations (or laziness). I agree that we need some sort of guide though. |
Using For consistency, I found that Another example is where to handle (print) error message:
mesabox/src/posix/chmod/mod.rs Line 238 in 1b32bde
Lines 147 to 151 in 1b32bde
But |
Everything using
|
Ok, understand. I found the You mentioned about using For this one brought up by @rdzhou : mesabox/src/posix/chmod/mod.rs Lines 156 to 166 in e906540
can be simplified, because the
Also, this are more confusing: mesabox/src/posix/chmod/mod.rs Lines 210 to 224 in e906540
Here, this returns error code or err type? Does |
It should be I’d need to spend some time to review but IIRC I’m still not entirely decided about what to do with the last error that gets returned from |
Hi,
I'm trying to contribute some code but get stuck in error handling.
One example I found for returning error is below. However, the
progname
anderr
are both None, which seems not very helpful.mesabox/src/posix/chmod/mod.rs
Lines 161 to 165 in e906540
Another example I found is below. This line is quite difficult to understand for new contributors.
mesabox/src/networking/ping/mod.rs
Line 279 in e906540
Could you give some guildeline for error handling in mesabox?
The text was updated successfully, but these errors were encountered: