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

How to return error with message or there is a better way? #15892

Closed
tisonkun opened this issue May 29, 2023 · 7 comments
Closed

How to return error with message or there is a better way? #15892

tisonkun opened this issue May 29, 2023 · 7 comments

Comments

@tisonkun
Copy link
Contributor

Based on my previous programming experience, it's common that I define a set of error codes and errors are constructed with a code with a detailed message.

It seems Zig provides error set enums to fit the error code part, while I don't know how to return errors with messages. Or it's Zig's best practice to representing errors fully by codes.

A real-world example is that - when I'm parsing a specific config file, I'd like to distinguish parsing errors and IO errors, but what exactly the parsing error is is not significant. While I still need to tell the caller about the details of the parsing error, the control flow is the same for all of them.

@squeek502
Copy link
Collaborator

The relevant issue is #2647

These types of questions should be directed at one of the community spaces instead.

@tisonkun
Copy link
Contributor Author

Thank you @squeek502!

I know and would love to ask in an active channel instead of the issue tracker. But see the "OT" comment at #15788 (comment) that I don't find any of the channel active.

@squeek502
Copy link
Collaborator

squeek502 commented May 29, 2023

Note that the Discord link has been fixed since that comment (#15759).

@tisonkun
Copy link
Contributor Author

Thank you. Let me try it again.

Closed this one as duplicated.

@tisonkun tisonkun closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2023
@tisonkun
Copy link
Contributor Author

tisonkun commented May 29, 2023

Emmm...seems still not work. I may expect a low bar platform distinguish from the issue tracker said a GH Discussions forum or I don't know if https://ziggit.dev/ is active (seems no too much traffics and replies). Sorry that as a user I will try to find the most active channel to ask questions where I can get response most responsively.

@squeek502
Copy link
Collaborator

squeek502 commented May 29, 2023

Discord is the most active, not sure why the invite link is not working for you. The https://discord.gg/zig link seems to be correct AFAICT.

IRC is also active but responses may be slower.

@tisonkun
Copy link
Contributor Author

I get it work now, both Discord and IRC. Thank you!

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

No branches or pull requests

2 participants