Update CHANGELOG and README

This commit is contained in:
Paul Campbell 2018-10-04 07:39:38 +01:00
parent 48e19fb653
commit e22ff4589f
2 changed files with 25 additions and 2 deletions

View file

@ -4,7 +4,7 @@ CHANGELOG
1.1.0 1.1.0
----- -----
* [result] orElseThrow() wraps the error exception in an unchecked MonResultException * [result] add orElseThrow(Class) and orElseThrowUnchecked()
1.0.0 1.0.0
----- -----

View file

@ -821,7 +821,7 @@
**** =T orElseThrow()= **** =T orElseThrow()=
Extracts the successful value from the result, or throws the error Extracts the successful value from the result, or throws the error
as the cause within a the unchecked exception =MonResultException=. =Throwable=.
#+BEGIN_SRC java #+BEGIN_SRC java
final Integer result = Result.of(() -> getValue()) final Integer result = Result.of(() -> getValue())
@ -829,6 +829,29 @@
#+END_SRC #+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)= **** =void onError(Consumer<Throwable> errorConsumer)=
A handler for error states. A handler for error states.