I am working on a library that handles connection with various imap servers (mail provider) like (Gmail, Outlook, Yahoo, Orange ...).
Into the subject, One method request the access token using a refresh token (OAuth2), this method may throw an exception for many reasons, (access revoked, invalidParameter, badRequest, invalidCredentials, dailyLimitExceeded, or no connection... Google Error Responses).
So for example, if I got a revoked access exception, I should handle it, so the next time, the user connect, we ask for his consent.
If I got a too many request exception, then I handle it by backing off...
The question: Is it appropriate to use Factory/delegate (C#) pattern to handle the different type of exceptions? Or should I handle it differently?
Thank you, and sorry for my English.
Aucun commentaire:
Enregistrer un commentaire