[MGNLACTIVATION-109] Change execute method from class ActivationCommand to throw more specific exceptions Created: 28/May/15  Updated: 01/Jun/16  Resolved: 01/Jun/16

Status: Closed
Project: Activation
Component/s: None
Affects Version/s: 5.3.2
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Richard Gange Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLACTIVATION-10 rewrite activation to use node api in... Closed
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

The class ActivationCommand throws a generic Exception in its execute method. The primary reason why we should avoid throwing Generic Exceptions, Throwable, Error etc is that doing in this way prevents classes from catching the intended exceptions. Thus, a caller cannot examine the exception to determine why it was thrown and consequently cannot attempt recovery.

  • Further more I did notice this class uses the deprecated Content class


 Comments   
Comment by Jan Haderka [ 31/Aug/15 ]

Regarding your second comment - MGNLACTIVATION-10 is all about dropping use of deprecated API.

Comment by Jan Haderka [ 01/Jun/16 ]

The reason why activation throws generic Exception is that it doesn't know what other, more specific, possible exceptions might be coming from client receiving the activation result. As customers can implement their own specific transport mechanism or subscription it is not possible to constrain exceptions without being too restrictive.
However us throwing generic exception doesn't preclude anyone from examining those exceptions and acting only on specific cases. We do not wrap specific exceptions in generic ones, we only declare that we do not know which of the specific exceptions might be thrown from the code called by the command.

Generated at Sun Feb 11 22:59:46 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.