1

My simple definition is usually:
Fail response - when a process failes to complete due to missing parameters Error response - when a process breaks due to unknown/unexpected reason.

Now, breaking the process flow over bad parameters (e.g. missing mandatory fields) is very easy to do (in java). At any given point you can just throw an exception with a code or a message.

Yet, usually people have the notion that you should use exceptions only in exceptional cases, meaning cases which you do not plan in the algorithm.

What are the cons of planning failed scenarios using exceptions

Bick
  • 17,833
  • 52
  • 146
  • 251

1 Answers1

0

Using exceptions for expected extraordinary cases is greatly inefficient. Exceptions are a poor choice for normal data paths in your software. The only case I would consider it a valid path is if this a backwater case in your program and you consider it very low traffic. There is an InvalidParamterException but it is "This exception, designed for use by the JCA/JCE engine classes"

Totoro
  • 615
  • 5
  • 11