asm: implement error handling (issue #11)