xenoterracide
04/30/2019, 6:50 PMsite = <http://dto.site|dto.site> ?: <http://this.site|this.site>!!
is this the best way to say use first if not null else use second if that also is null thow?kevinherron
04/30/2019, 6:52 PMsite = <http://dto.site|dto.site> ?: <http://this.site|this.site> ?: throw FooEx()
!!
and it fails it's a programming errorxenoterracide
04/30/2019, 6:54 PMkevinherron
04/30/2019, 6:55 PMShawn
04/30/2019, 6:56 PMCasey Brooks
04/30/2019, 6:57 PMcheck
or checkNotNull
stdlib functions for this, to give some more info in stacktraces site = checkNotNull(<http://dto.site|dto.site> ?: <http://this.site|this.site>) { "Site cannot be null" }
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/check-not-null.htmlkevinherron
04/30/2019, 6:58 PMPreconditions
from guavastreetsofboston
04/30/2019, 6:59 PMEither<E,T>
as the type of this expression.obobo
04/30/2019, 8:47 PM?: error("Message describing what was expected")
too, if you don't mind throwing an IllegalStateException