Why isnt this exception caught? What am I doing wrong