fixing issue #1317

First approach to solving the issue presented. Essentially was just eliminating the **stderr and **exit usage and substituting it with raise <exception> form.