yoti-java-sdk
yoti-java-sdk copied to clipboard
Exceptions & Error Handling
Hi guys,
I've been thinking that from a client perspective, using the Yoti Client to call getActivityDetails(token)
can be a somewhat confusing operation to deal with when it comes to failure modes.
The method signature does helpfully document the checked exception com.yoti.api.client.ProfileException
. However the JavaDoc is somewhat vague about when and why this might happen and who may be at fault.
I'm not suggesting we necessarily should change the method signature or even necessarily the JavaDoc. However, what might be good to know from a documentation perspective (even the project README.md) is what main/likely scenarios cause this.
E.g. even with a little internal knowledge I'm not entirely clear whether this exception could be raised due to:
- An issue connecting to Yoti Connect.
- Some type of deserialization issue or runtime issue constructing the objects required to build the ActivityDetails.
- An invalid token being supplied.
- An issue with the profile of the user using the application. E.g. if my Yoti app required name, selife, DOB and email and one or more of these attributes is not present in the users profile can I identify this scenario with this exception?
The importance of the distinction can be as simple as "what error message I want to display to the user (i.e. is it something they did wrong and I can provide them a tip/help to fix it) or is it something wrong on the server or intermittent issue talking to Yoti".
However, this may also impact developers at a more technical level, e.g. whether I pick a HTTP 4xx or 5xx series response code and whether I'd choose to log the error or not.
It may also impact whether I'd want alerting tools to pick this up, e.g. if it's a user error probably not - but if it's some connectivity issue or server-side problem perhaps I want proactive alerting.
Just want to open a dialog for discussion on this guys. Thanks.