Update example in README

The previous example was using methods that have been deprecated in favour of a new API that improves error reporting.