Golo provides 2 predefined functions for raising exceptions:
raise(message)
throws a java.lang.RuntimeException
with a message given as a string, and
raise(message, cause)
does the same and specifies a cause which must be an instance of
java.lang.Throwable
.
Throwing an exception is thus as easy as:
if somethingIsWrong() { raise("Woops!") }