-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add error.hpp and tl::expected library #9
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
Conversation
b63b2ad to
861a608
Compare
| enum class Error : std::uint32_t { | ||
| KReserved1 = 0, | ||
| KReserved2 = 1, | ||
| /* Common lib errors: 2-99 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case we decide to do:
- some kind of casting to
LDBoolean(0/1) - Generic success
- Generic failure
I've just reserved the first two values.
| /* Client-side errors: 100-199 */ | ||
| /* Server-side errors: 200-299 */ | ||
|
|
||
| kMax = std::numeric_limits<std::uint32_t>::max() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kMax is just here to make us remember to do something similar in C, to help with ABI stability as we add new values in the future.
Pulls in the
tl::expectedlibrary for error handling. The idea is that we can return value types, as well as an error code from functions. I believe something similar is slated forstd::.It has nice things like
mapbuilt in.I'm not 100% all in on having a single
Errorenum, I just thought it'd be simpler to ensure unique unique error codes from a C standpoint.