#48, #54: handle import errors and improve captured exceptions