https://kotlinlang.org logo
#announcements
Title
# announcements
l

Leon K

12/05/2019, 4:11 PM
is it possible to throw custom exceptions using
require
and
requireNotNull
? currently afaik it always throws an
IllegalArgumentException
s

Stephan Schroeder

12/05/2019, 4:25 PM
apart from writing your own mehtods, nope.
z

Zach Klippenstein (he/him) [MOD]

12/05/2019, 6:01 PM
require(NotNull)
throws
IllegalArgumentException
,
check(NotNull)
throws
IllegalStateException
, if you want something else just write an if statement and throw an exception, it’s barely even boilerplate.
☝️ 2
13 Views