mercredi 1 avril 2020

Handling Exceptions using Strategy Pattern with different Libaries?

I'm using the Strategy pattern for different strategies. These different strategies use different libraries. The libraries throw their own exceptions.

How would you go about handling a few specific situations which involve exceptions?

Let's use the example below. When adding an email to a list, the external API libraries can throw exceptions (e.g. 'DuplicateEmailException'). When calling those methods, the situation might be the same (an email is duplicate), yet the concrete exception classes differ (due to it being different libraries).

enter image description here

Aucun commentaire:

Enregistrer un commentaire