Skip to content

Instantly share code, notes, and snippets.

@mather
Created March 25, 2014 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mather/9758177 to your computer and use it in GitHub Desktop.
Save mather/9758177 to your computer and use it in GitHub Desktop.
class MyException(message: String = null, cause: Throwable = null) extends RuntimeException(message, cause) {
def this(cause: Throwable) = this(Option(cause).map(_.toString).getOrElse(null), cause)
}
new MyException()
new MyException("msg")
new MyException(new Exception("hoge"))
new MyException("addtional message", new Exception("hoge"))
new MyException(cause = new Exception("hoge"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment