Question: In java exceptions have at least these four constructors:

```
Exception() 
Exception(String message) 
Exception(String message, Throwable cause) 
Exception(Throwable cause) 

```

If you want to define your own extensions, you just have to declare a descendent exceptions and implement each desired constructor calling the corresponden super constructor

How can you achieve the same thing in scala?

so far now I saw [this article](https://lizdouglass.wordpress.com/2010/12/15/scala-multiple-constructors/) and this [SO answer](https://stackoverflow.com/a/3300046/47633), but I suspect there must be an easier way to achieve such a common thing

Answer: 
You can use `Throwable.initCause`.

```
class MyException (message: String, cause: Throwable) 
  extends RuntimeException(message) {
    if (cause != null)
      initCause(cause)

    def this(message: String) = this(message, null)  
}

```
Here is a similar approach to the one of @roman-borisov but more typesafe.

```
case class ShortException(message: String = "", cause: Option[Throwable] = None)
    extends Exception(message) {
  cause.foreach(initCause)
}

```

Then, you can create Exceptions in the Java manner:

```
throw ShortException() 
throw ShortException(message) 
throw ShortException(message, Some(cause)) 
throw ShortException(cause = Some(cause)) 

```