There's no hard-and-fast rule, but I've generally found that *expected*
exceptions should be handled in code, with normal message.  Supervision is
more about the assumption that *something* is going to go wrong in
unexpected ways, so have a plan to respond to that.

To your particular case, I would absolutely handle incorrect credentials
(or almost any other such easily-anticipated user error) as a normal case,
using normal message pathways...

On Mon, Nov 14, 2016 at 1:14 PM, 'Erik' via Akka User List <
[email protected]> wrote:

> Hi guys
>
> is there a best-practice to determine when failures should be handled via
> fault tolerance / supervision versus with a normal message?
>
> *Example*: A user wants to *authenticate* with a username / password. I
> start a separate actor to handle the authentication (since it might fail).
> If the user entered wrong credentials, should that idiomatically be
> represented by an exception that is then handled by the supervisor? Or
> should that just be a message sent back and handled at a different layer?
>
> *To generalize*, I wonder how to best think about when to use the fault
> tolerance over normal messages. Both approaches could be taken to the
> extreme (handle all "unexpected" events via exceptions / handle all
> exceptions via messages). So where is the fine line between them? What
> could I use to help decide the question in specific cases? The docs seem to
> encourage putting "risky calculations" into separate actors; but is an
> authentication with wrong credentials "risky" in that context?
>
> Thanks
> Erik
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to