This commit is contained in:
7
deps/ox/ox-docs.md
vendored
7
deps/ox/ox-docs.md
vendored
@@ -28,10 +28,7 @@ All components have a platform indicator next to them:
|
|||||||
Ox provides ```ox::Error``` to report errors.
|
Ox provides ```ox::Error``` to report errors.
|
||||||
```ox::Error``` is a struct that has overloaded operators to behave like an
|
```ox::Error``` is a struct that has overloaded operators to behave like an
|
||||||
integer error code, plus some extra fields to enhance debuggability.
|
integer error code, plus some extra fields to enhance debuggability.
|
||||||
If instantiated through the ```OxError(x)``` macro, it will also include the
|
```ox::Error```s will also include the file and line of the error.
|
||||||
file and line of the error.
|
|
||||||
The ```OxError(x)``` macro should only be used for the initial instantiation of
|
|
||||||
an ```ox::Error```.
|
|
||||||
|
|
||||||
In addition to ```ox::Error``` there is also the template ```ox::Result<T>```.
|
In addition to ```ox::Error``` there is also the template ```ox::Result<T>```.
|
||||||
```ox::Result``` simply wraps the type T value in a struct that also includes
|
```ox::Result``` simply wraps the type T value in a struct that also includes
|
||||||
@@ -49,7 +46,7 @@ ox::Result<int> foo(int i) noexcept {
|
|||||||
if (i < 10) {
|
if (i < 10) {
|
||||||
return i + 1; // implicitly calls ox::Result<T>::Result(T)
|
return i + 1; // implicitly calls ox::Result<T>::Result(T)
|
||||||
}
|
}
|
||||||
return OxError(1); // implicitly calls ox::Result<T>::Result(ox::Error)
|
return ox::Error(1); // implicitly calls ox::Result<T>::Result(ox::Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
int caller1() {
|
int caller1() {
|
||||||
|
|||||||
Reference in New Issue
Block a user