Updated error detection and reporting.

Signed-off-by: Stephan Peijnik <speijnik@anexia-it.com>