Add basic error handling to example

Change-Id: I23fd6ecba4c5718241d8d2a508ee24910d4d8fa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>