Catch all system call errors, and cleanup exception handling a little to make it more generic

Signed-off-by: Ken Barber <ken@bob.sh>