Added a sort of error handling on front end, added error throwing/conversion on back end