sc-hsm: Improve error detection and reporting in sc-hsm-tool