Open
Description
When i use Try.getOrElseThrow
, i get the following error:
This is the code in question:
val flow = Try { flowDao.save(Flow(source.name, source.applicationId)) }
.getOrElseThrow { FlowNameAlreadyInUse() }
This is my exception:
@ResponseStatus(HttpStatus.CONFLICT)
class FlowNameAlreadyInUse : RuntimeException()
I am using it the same way that i would throw an exception with java.util.Optional.getOrElseThrow
, so i believe this to be a bug.
I can make it work by putting the exception in a lambda, but i believe this to be a bad solution, especially given that IntelliJ keeps suggesting me to remove the useless lambda.
val flow = Try { flowDao.save(Flow(source.name, source.applicationId)) }
.getOrElseThrow { -> FlowNameAlreadyInUse() }
Metadata
Assignees
Labels
No labels
Activity