Best way to return status flag and message from a method in Java

后端 未结 17 1236
清酒与你
清酒与你 2020-12-25 12:55

I have a deceptively simple scenario, and I want a simple solution, but it\'s not obvious which is \"most correct\" or \"most Java\".

Let\'s say I have a small authe

17条回答
  •  孤独总比滥情好
    2020-12-25 13:11

    Just because failed authentication is commonplace doesn't mean it isn't exceptional.

    In my opinion, authentication failures are the poster-child use case for checked exceptions. (Well... maybe file non-existence is the canonical use case, but authentication failure is a close #2.)

提交回复
热议问题