exception catching whilst saving database