I would like to know your thoughts if using a statement like "return output;" in the catch block is a good design practice. The design contract we have with the external calling entity is to populate the output object with values and success message in case of success and error code and error message in case of failure. We do not propagate a java exception back to the external calling entity but instead capture the details of the exception in the catch block, populate the output object with the relevant exception details and send it back to the external calling entity. Now my question is this design approach right to return back from a catch block. This way I am actually trying to exit from the particular flow of the program. There are also scenarios (some catch blocks) where we will not return i.e exit the program flow. Instead just log the exception and proceed with the next step in the flow.
Yes, it's a totally valid coding practice, although I would advise to use it carefully.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus