To complete your code you should add some error handing, to catch exceptions. All you need to do is put the wrapper function calls in a try-catch block as follows.
It is up to you to decide how to handle the errors. We also recommend that you log them for debugging purposes.
You must know!
Our example code is an illustration of how you might integrate with our systems and is not certified for production environments. You are responsible for testing and QA.