handle errors in pynma