Made the errors actual exceptions