(defn throw-when-nil-or-empty [coll]
(cond
(nil? coll) (throw (IllegalArgumentException. "is nil"))
(empty? coll) (throw (IllegalStateException. "is empty"))))
;; catch clauses are tried top down, the first matching type wins
(try
(throw-when-nil-or-empty [])
(catch IllegalArgumentException e
(println "list is not specified"))
(catch IllegalStateException e
(println (str (.getName (class e)) ": list is empty"))))