[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