Simplify error handling

This code block is needlessly complex.

Change-Id: I41375458d21e38267cd0a1d21b0b14ab498fc172