Update CHANGELOG and README
This commit is contained in:
parent
48e19fb653
commit
e22ff4589f
2 changed files with 25 additions and 2 deletions
|
@ -4,7 +4,7 @@ CHANGELOG
|
|||
1.1.0
|
||||
-----
|
||||
|
||||
* [result] orElseThrow() wraps the error exception in an unchecked MonResultException
|
||||
* [result] add orElseThrow(Class) and orElseThrowUnchecked()
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
|
|
25
README.org
25
README.org
|
@ -821,7 +821,7 @@
|
|||
**** =T orElseThrow()=
|
||||
|
||||
Extracts the successful value from the result, or throws the error
|
||||
as the cause within a the unchecked exception =MonResultException=.
|
||||
=Throwable=.
|
||||
|
||||
#+BEGIN_SRC java
|
||||
final Integer result = Result.of(() -> getValue())
|
||||
|
@ -829,6 +829,29 @@
|
|||
#+END_SRC
|
||||
|
||||
|
||||
**** =<E extends Exception> T orElseThrow(Class<E> type) throws E=
|
||||
|
||||
Extracts the successful value from the result, or throws the error when it
|
||||
is of the given type. Any other errors will be thrown inside an
|
||||
=UnexpectedErrorResultException=.
|
||||
|
||||
#+BEGIN_SRC java
|
||||
final Integer result = Result.of(() -> getValue())
|
||||
.orElseThrow(IOException.class);
|
||||
#+END_SRC
|
||||
|
||||
|
||||
**** =T orElseThrowUnchecked()=
|
||||
|
||||
Extracts the successful value from the result, or throws the error within
|
||||
an =ErrorResultException=.
|
||||
|
||||
#+BEGIN_SRC java
|
||||
final Integer result = Result.of(() -> getValue())
|
||||
.orElseThrowUnchecked();
|
||||
#+END_SRC
|
||||
|
||||
|
||||
**** =void onError(Consumer<Throwable> errorConsumer)=
|
||||
|
||||
A handler for error states.
|
||||
|
|
Loading…
Reference in a new issue