# Supervision: Getting hold of Exception

**URL:** https://discuss.akka.io/t/supervision-getting-hold-of-exception/6094
**Category:** Akka Libraries
**Created:** [March 12, 2020, 4:24pm UTC](https://discuss.akka.io/t/supervision-getting-hold-of-exception/6094 "2020-03-12T16:24:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dubaut](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/dubaut/32/1912_2.png) [@dubaut](https://discuss.akka.io/u/dubaut)
#### Post date: [March 12, 2020, 4:24pm UTC](https://discuss.akka.io/t/supervision-getting-hold-of-exception/6094/1 "2020-03-12T16:24:13Z")

</div>

Let’s take a simple example:

```auto
Behaviors.supervise {
  Behaviors.receiveMessage[Command] { [..] }
}.onFailure[Throwable](SupervisorStrategy.resume)

```

How can I get hold of the `Throwable`, process it and than resume the actor?

---

<div class="post-metadata">

### Author: ![patriknw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/patriknw/32/89_2.png) [@patriknw](https://discuss.akka.io/u/patriknw)
#### Post date: [March 12, 2020, 4:55pm UTC](https://discuss.akka.io/t/supervision-getting-hold-of-exception/6094/2 "2020-03-12T16:55:14Z")

</div>

You can have different `onFailure` handlers for different types of exceptions, but more details of the exception than that is by design not available. The reason is that the supervisor strategy should not do too much. Typically the supervisor strategy should be selected by the parent actor that is spawning the behavior. Communicating between the child and parent via exceptions is not a good approach.

If you need to handle exceptions in more detail it should probably be part of the message handler, i.e. using an ordinary try-catch when processing the message.
