catch the errors then return