parent
6651b18905
commit
434b8aa7fb
@ -19,7 +19,7 @@ fun <V, E> Result<V, E>.unwrap(): V {
|
||||
|
||||
return when (this) {
|
||||
is Ok -> value
|
||||
is Err -> throw UnwrapException("called Result.wrap on an Err value $error")
|
||||
is Err -> throw UnwrapException("called Result.unwrap on an Err value $error")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ class UnwrapTest {
|
||||
|
||||
@Test
|
||||
fun throwsExceptionIfErr() {
|
||||
assertFailsWith<UnwrapException>("called Result.wrap on an Err value 5000") {
|
||||
assertFailsWith<UnwrapException>("called Result.unwrap on an Err value 5000") {
|
||||
@Suppress("IMPLICIT_NOTHING_AS_TYPE_PARAMETER")
|
||||
Err(5000).unwrap()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user