# Custom error throwing "Unhandled Exception Type" when called

**URL:** <https://discourse.processing.org/t/custom-error-throwing-unhandled-exception-type-when-called/15152>\
**Category:** Beginners\
**Created:** [November 2, 2019, 3:52pm UTC](https://discourse.processing.org/t/custom-error-throwing-unhandled-exception-type-when-called/15152 "2019-11-02T15:52:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragon\_hatcher](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dragon\_hatcher](https://discourse.processing.org/u/dragon_hatcher)\
**Post date:** [November 2, 2019, 3:52pm UTC](https://discourse.processing.org/t/custom-error-throwing-unhandled-exception-type-when-called/15152/1 "2019-11-02T15:52:05Z")

</div>

What am I doing wrong?

Here is my code:

```auto
void setup() {
  size(100, 100);

  throw new customException("test");
}

class customException extends Exception{
    
  customException(String message){
    super(message);
  }
}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 2, 2019, 4:20pm UTC](https://discourse.processing.org/t/custom-error-throwing-unhandled-exception-type-when-called/15152/2 "2019-11-02T16:20:45Z")

</div>

- [Processing.org/reference/try.html](http://Processing.org/reference/try.html)
- [Processing.org/reference/catch.html](http://Processing.org/reference/catch.html)
- [Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Exception.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Exception.html)

```auto
void setup() {
  try {
    throw new CustomException("test");
  } 
  catch (final CustomException ex) {
    ex.printStackTrace();
    exit();
  }
}

class CustomException extends Exception {
  CustomException(final String msg) {
    super(msg);
  }
}

```
