Follow API refactoring.

Now using exceptions for better control flow.

Change-Id: I4432721729f6b1878971c99f5eaaa033194cd8ba
1 file changed