[power] throw an exception instead of blocking forever

In synchronous calls, throw an exception instead of blocking
forever when the underlying system API returns an error.
Modified example to show usage.

BUG=XWALK-1390
Merge pull request #316 from eurogiciel-oss/XWALK-1390

[power] throw an exception instead of blocking forever