Skip to content

Commit dd696a4

Browse files
committed
DONT MERGE
1 parent 7884e95 commit dd696a4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ add_executable(foo foo.cpp)
4646
target_link_libraries(foo PRIVATE errors::errors)
4747
```
4848

49+
## Usage
50+
51+
This package contains an `errors::Error` class, representing an error object.
52+
A function that may result in errors should returns this object so that the error could be handled properly.
53+
54+
```c++
55+
errors::Error print_hex(const char* number_str);
56+
57+
int main() {
58+
const auto err = print_hex(number_str);
59+
if (err) {
60+
// error, do something.
61+
}
62+
63+
// no error, continue.
64+
}
65+
```
66+
67+
On a function that returns `errors::Error`, it can returns `errors::nil` to indicate that there's no error or returns an error object
68+
69+
See the [examples](./examples) for further details on how to use this package.
70+
4971
## License
5072
5173
This project is licensed under the terms of the [MIT License](./LICENSE).

0 commit comments

Comments
 (0)